To read the file line by line use:
cat sample.txt | while read line; do echo $line; done
To read the file element (word) by element you can use:
for word in `cat sample.txt`; do echo $word; done
or
while read line; do echo $line; done < sample.txt
No comments:
Post a Comment