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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

read file 1

Status
Not open for further replies.

johny2K

Technical User
Dec 19, 2001
184
CA
i want to read a file, line-by-line, print/echo each line until it figure out it is the end of the row & exit.

cheers!
 
You'll have to explain what "until it figure out it is the end of the row" means.

A line - by definition - contains the end of a row, so reading line by line doesn't mean a great deal.



--
 
sorry, i mean - after the very last "line" inside the file.
 
Something like this ?
while read buf
do echo "$buf"
done</path/to/inputfile

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
Cat file" will not deal well with spaces if you wish to process line by line

Read will read a full line
"This is a line"
and you can use it as a single variable,
but if you use cat it will be 4 variables.

And i assume that the issue here is not just to echo each line, but to do something with it.


Regards

Frederico Fonseca
SysSoft Integrated Ltd
 
you are right frederico... i want to manipulate each line that's being spitted ... :D
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top