Dirk Dirk - 1 year ago 36
Bash Question

Run a script over multiple files in unix

Started to learn some shell scripting. I have a perl script that runs on one file. How would I write a shell script to run the perl script a bunch of times on all files with keyword "filename" in it?

So in English,

for /filename/ in filenames
perl myscript.pl completefilename


Answer Source
find . -name "filename*" -exec perl myscript.pl '{}' \; 
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download