Pages

Tuesday, June 21, 2011

How to Read a file line by line in Shell Script?

We can read a file  , line by line  using shell script,
with the following approach.

FILE="/etc/hosts"
cat $FILE | while read LINE
do 
echo " $LINE"
done

Reference: http://bashscript.blogspot.com/2010/05/how-to-read-file-line-by-line-in-shell.html

No comments:

Post a Comment