Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

assign lines to variable from file 1

Status
Not open for further replies.

kasparov

Programmer
Feb 13, 2002
203
GB
If I do this:

for line in `cat file`
do
echo $line
done

I don't get a line in each iteration but a string (white space separated) - can someone tell me how to get a line in each iteration?

I know I've seen it here once before (I think it involved while ... do) but the search is still out.

Thanks, Chris
 
Chris:

while read line
do
echo $line
done < file
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top