Created
April 4, 2012 15:08
-
-
Save timhodson/2302411 to your computer and use it in GitHub Desktop.
loop through files and feed contents to a script to process them
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# where patterns are in files numbered like pattern_file_01.txt | |
for pattern in `ls pattern_file_??.txt` | |
do | |
STRING=`cat $pattern` | |
php -f myCleverScipt.php -- $STRING | |
done | |
# where patterns are single lines of a single file | |
while read line | |
do | |
# do something with the line here | |
done << myFileOfPatterns.txt | |
# one line - do not put semicolon after do | |
while read line ;do echo $line ; othercmd ; sleep 4 ; done << myFileOfPatterns.txt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment