When reading a file in a for loop in bash, the following idiom will read each work (whitespace delimited):
for word in `cat file.txt`; do echo $word; done
If you want to grab the whole line then you can do this:
while read line; do echo $line; done < file.txt
or
cat file.txt | while read line; do echo $line; done
This comment has been removed by a blog administrator.
ReplyDelete