user2300940
user2300940

Reputation: 2385

for loop with standard output

I want to run two scripts (gunzip and fastx_collapser) for multiple input files. The output from gunzip should be input to fastx_collapser. How do I do this in a loop function?

My try:

for f in *.gz    gunzip -c "$f"  | fastx_collapser -Q33 -z -o  "${f%}.coll.gz"

Upvotes: 0

Views: 34

Answers (1)

Jonathan Leffler
Jonathan Leffler

Reputation: 754570

You need a do and a done (and some semicolons if you insist on a single line):

for f in *.gz
do
    gunzip -c "$f" | fastx_collapser -Q33 -z -o "${f%}.coll.gz"
done

or:

for f in *.gz; do gunzip -c "$f" | fastx_collapser -Q33 -z -o "${f%}.coll.gz"; done

Upvotes: 1

Related Questions