Read a file line by line


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

Reads a linux file, line by line


Copy this code and paste it in your HTML
  1. #!/bin/sh
  2. while read LINE
  3. do
  4. echo "processing $LINE"
  5. done < your_input_file
  6.  
  7. An example of your_input_file would be:
  8.  
  9. one
  10. two
  11. three
  12.  
  13. Each line in your_input_file will be read into LINE.

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.