|
Processing a text file
A file contains one name per line, such as:
Code:
john doe
jack bruce
nancy smith
sam riley
When I 'cat' the file, the white space is treated as a new line. For example
Code:
list=`(cat /path/to/file.txt)`
for items in $list
do
echo $items
done
I get:
Code:
john
doe
jack
bruce
nancy
smith
sam
riley
How can I get each line to be echoed (so the full names are on their own line), not each item separated by whitespace?
Thanks
|