Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

How can you process a file line by line in ksh?

share|improve this question
add comment

2 Answers

up vote 4 down vote accepted

somthing like:

while read LINEVAR ; do echo ${LINEVAR} ; done < myfile.txt

which will read one line of input from myfile.txt at a time?

share|improve this answer
    
Just a word of warning -- without double quotes around it, many spaces (or whatever IFS is set to) will be reduced to one space. Nulls always vanish in shells script output. Not that we need nulls for anything. But they are useful for some reason in binary files. –  chris May 17 '10 at 14:24
add comment

Check bellow link, I have posted 5 different methods with timing comparison.

Different ways to process a file line by line in a shell script

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.