Run the same command on every line in a file

Posted by & filed under Code Tips.

This snippet will let you run the same command using each line from a file as a parameter. cat filename.txt | while read in; do echo “$in”; done As written it’ll open up filename.txt and echo out every line. Probably not what you want, so replace echo “$in” with whatever command you want to run…. Read more »