while read line
do
echo "read line is $line"
done < $file
where $file is file having following contents
1=one
2=two
3=three
but above while loop is not able to print last line !!
why ?
while read line
do
echo "read line is $line"
done < $file
where $file is file having following contents
1=one
2=two
3=three
but above while loop is not able to print last line !!
why ?
Normally it should display the last line, nothing bad about the loop. Show the output of
od -c $infile
and please use CODE tags here in the forum when displaying.
Probably the last line doesn't have a linefeed. Add a linefeed to the file with:
echo "" >> file
Regards
depending on what you want to do with each line, you can use tools like awk
awk '{print}' file