Running Batch Files From Command Line
I have around 50 similar .txt files in a folder. I extracted the info I need from txt files. I was wondering how to run all these 50 files (less *.gz.txt| awk '... doesn't create .output.txt for individual input .txt files) in a single run with individual output files?
Input files look like below:
BACP0000929|xaiA|gi|302543193|ref|ZP_07295535.1|_<97>:0:664:+ 0 0.0 0.0 0.0
BACP0000011|fytD|gi|340626483|ref|YP_004744935.1|_<97>:0:657:+ 0 0.0 0.0 0.0
BACP0008288|cuyD|gi|365866299|ref|ZP_09405920.1|_<97>:0:660:+ 0 0.0 0.0 0.0
Used command:
less 9673.fna.gz.txt | awk '{OFS="\t"; split($1,x,"|"); print x[2], $2}'| awk '$2 > 0'| sort -k2r| uniq –c | sort -rn > output.txt
Output:
286 xaiA 1
236 FabB 1
170 uyTB 1
166 yuTB 1
152 iopC 1
• 2,509 views
•
link
0 answers
No answers yet.
Log in to answer this question.
for i in *.txt;do cat $i | awk . . . >$(basname $i .txt).output.txt;done
And now that I've sent you on the right track, I'm closing this question because it's really a programming question, not a bioinformatics question. You'd have better luck with stack overflow, or better yet, a basic BASH tutorial website.
Use GNU Parallel to parallelize: