[Solved] Multiple input files and output files

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting [Solved] Multiple input files and output files
# 1  
Old 01-22-2014
[Solved] Multiple input files and output files


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,

Last edited by Franklin52; 01-23-2014 at 03:41 AM.. Reason: Please use code tags
# 2  
Old 01-22-2014
Will this work?
for file in test*.ft1
        pipe2txt.tcl < "$file" > "${file/\.ft1/\.txt}"

# 3  
Old 01-23-2014

Thanks for this - it works.

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


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,

Last edited by Franklin52; 01-23-2014 at 10:36 AM.. Reason: Please use code tags
# 4  
Old 01-23-2014
for file  in /path/to/ft/test1.*; do 

      echo <your command goes here>


# 5  
Old 01-23-2014
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
        pipe2txt.tcl -index ppm < "$file" >  txt/"${file/ft1/txt}"

executing gives the error: no file of directory.

Could you please help?

Last edited by Franklin52; 01-23-2014 at 11:08 AM.. Reason: Please use code tags
# 6  
Old 01-23-2014
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.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

SBATCH trinity for multiple files and rename/move the output files

Hey guys, I have wrote the following script to apply a module named "trinity" on my files. (it takes two input files and spit a trinity.fasta as output) #!/bin/bash -l #SBATCH -p node #SBATCH -A <projectID> #SBATCH -n 16 #SBATCH -t 7-00:00:00 #SBATCH --mem=128GB #SBATCH --mail-type=ALL... (1 Reply)
Discussion started by: @man
1 Replies

2. Shell Programming and Scripting

Grep strings on multiple files and output to multiple files

Hi All, I want to use egrep on multiple files and the results should be output to multiple files. I am using the below code in my shell script(working in Ksh shell). However with this code I am not attaining the desired results. #!/bin/ksh ( a="/path/file1" b="path/file2" for file in... (4 Replies)
Discussion started by: am24
4 Replies

3. Shell Programming and Scripting

[Solved] How to remove multiple files?

Hi Gurus, I have below files in one directory. the file name has date and time portion which is exactly the file be created. I need keep only lasted created file which is abc_20140101_1550 and remove rest of the file. abc_20140101_1300 abc_20140101_1200 abc_20140101_1400 abc_20140101_1500... (2 Replies)
Discussion started by: ken6503
2 Replies

4. Shell Programming and Scripting

Split: File into multiple and keeping the same 3 lines from input into all output files

The following code will split the infile into multiple files. However, I need it to insert the same first 3 lines from the original input file into each splitted file. How do I modify my script below to do so: print -n "Enter file name to split? " ; read infile if then echo "Invalid file... (4 Replies)
Discussion started by: mrn6430
4 Replies

5. UNIX for Dummies Questions & Answers

[SOLVED] Rename multiple files

Hi. I have a large number of files with names like: t_ 0.20000E-02.dat There is actually a space after the underscore. These files are numbered numerically, i.e. t_ 0.20000E-02.dat, t_ 0.21000E-02.dat, t_ 0.22000E-02.dat and so on. What I would like to do is rename such that the file with... (8 Replies)
Discussion started by: lost.identity
8 Replies

6. Shell Programming and Scripting

[SOLVED] moving multiple files? mv

HI I have a list of files that are incorrectely names and I need to move them to new name .. I tried few things that has not worked so far can you help ? I need to rename all thes eifle ( tere are over 100 ) xldn0357bap.orig.new xldn0389bap.orig.new xldn0439bap.orig.new... (12 Replies)
Discussion started by: mnassiri
12 Replies

7. Shell Programming and Scripting

awk, multiple files input and multiple files output

Hi! I'm new in awk and I need some help. I have a folder with a lot of files and I need that awk do something in each file and print a new file with the output. The input file name should be modified when I print the outpu files. Thanks in advance for help! :-) ciao (5 Replies)
Discussion started by: gabrysfe
5 Replies

8. UNIX for Dummies Questions & Answers

Using AWK: Extract data from multiple files and output to multiple new files

Hi, I'd like to process multiple files. For example: file1.txt file2.txt file3.txt Each file contains several lines of data. I want to extract a piece of data and output it to a new file. file1.txt ----> newfile1.txt file2.txt ----> newfile2.txt file3.txt ----> newfile3.txt Here is... (3 Replies)
Discussion started by: Liverpaul09
3 Replies

9. Shell Programming and Scripting

building output file from multiple input files

Hi there, I am trying to figure out a way to combine multiple sources with different data on a single file, and I am trying to find the best way to do it. I have multiple files, let's say A, B, C and D. A has a field in common with B, B has a field in common with C, and C has a field in... (2 Replies)
Discussion started by: ppucci
2 Replies

10. Shell Programming and Scripting

Splitting input files into multiple files through AWK command

Hi, I needs to split *.txt files from single directory depends on the some mutltiple input values. i have wrote the code like below for file in *.txt do grep -i -h "value1|value2" $file > $file; done. My requirment is more input values needs to be given in grep; let us say 50... (3 Replies)
Discussion started by: arund_01
3 Replies
Login or Register to Ask a Question