[Solved] Multiple input files and output files

Hi,

I have many test*.ft1 files to which I want to read as input for a script called

pipe2txt.tcl and print the output in each separate file.

For example,

pipe2txt.tcl < test001.ft1 > test001.txt

How can I read many files in this maner?

thank you very much,
Best,
Pahuja

Will this work?

for file in test*.ft1
do
        pipe2txt.tcl < "$file" > "${file/\.ft1/\.txt}"
done

Hi,

Thanks for this - it works.

---------- Post updated at 09:07 AM ---------- Previous update was at 04:04 AM ----------

Hi,

I have one more question. How can I read the multiple input files, test1.Ft1, test2.ft1, etc. from a folder 'ft', execute the script pipe2txt.tcl on them and print output in another directory, txt as test1.txt, test2.txt, etc?

Fro example,

pipe2txt.tcl < ft/test001.ft1 > txt/test001.txt

Thanks a lot,
pahuja

for file  in /path/to/ft/test1.*; do 

      echo <your command goes here>

done

Hi Akshay,

Thanks for your suggestion.

ft and txt directories are in the same folder where the script pipe.com is there.
piepe.com consists the following code:

for file in ft/test*.ft1
do
        pipe2txt.tcl -index ppm < "$file" >  txt/"${file/ft1/txt}"
done

executing gives the error: no file of directory.

Could you please help?
Thanks,
Pahuja

Could you post the entire, complete error, word for word, letter for letter, keystroke for keystroke? I'd like to know which file it doesn't think exists please.

Also, try set -x to display each line of code as its executed, which may reveal what names are being mangled or what have you.