looping through lines in a file in shell

/ Published in: Textpattern
Save to your folder(s)

Copy this code and paste it in your HTML
  1. Hi,
  2. I am trying to loop through the lines of a file in shell. The code I am using is
  4. #!/usr/bin/ksh
  5. for line in `cat /tmp/file1.txt`
  6. do
  7. echo $line
  8. done
  10. Intead of getting the output in lines , i am getting word by word.
  12. What may be the problem ?
  14. Thanks,
  15. chaitanya

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.