PDA

View Full Version : [SOLVED] bash wildcards for output



nickpick
October 8th, 2012, 06:19 PM
Hi guys,

I apologise in advance if this is the entirely wrong section, but I've got a question about using bash wildscards. Here's the situation:


I have X files with identical names, except for the number at the end, e.g. Test001.txt, Test002.txt, Test003.txt, etc.
I want to send every file to a Perl script with the following syntax: "script_lalala Test001.txt > Test001.ready"


How I know that I can use the asterisk (*) to read every file with something like cat, i.e. "cat Test*.txt". How would I go about doing the same thing with the script above?

Thanks in advance!

Lars Noodén
October 8th, 2012, 06:32 PM
Would this do the trick?



for i in test{001..005};do script_lalala $i.txt > $i.ready;done

nickpick
October 8th, 2012, 06:39 PM
Would this do the trick?



for i in test{001..005};do script_lalala $i.txt > $i.ready;done


Works for me. Many thanks.