faqts : Computers : Programming : Languages : Unix Shell

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

367 of 390 people (94%) answered Yes
Recently 10 of 10 people (100%) answered Yes


how to read a text file line by line using Korn Shell

Aug 14th, 2002 10:58
Allan Caetano, Jim Snyder, Farouk Kadri,

while read line_by_line
      echo ${line_by_line}
done < myfile.txt
A slightly more complicated, but more flexible, version:
exec 4<yourfile.txt
while read each_line <&4
    print ${each_line}
exec 4<&-