I often create a quick bash script on the fly that cats a file, and does something with each line.
For the example, we have a text file (text.txt) that contains the following:
a b c
d e f
g h i
When you cat text.txt, you get the above results. But try running:
for i in `cat text.txt`
do
echo $i
done
And you get
a
b
c
d
e
f
g
h
i
To get the desired results, the following will work:
cat text.txt | while read line; do
echo $line
done