How do I set up a command-line program to run through all my input files in a folder?
Assume my input files are named like below and vary in the part between _
and .txt
:
IsomiR_377G.txt,
IsomiR_377R.txt,
IsomiR_379G.txt,
....
any my program is named bowtie
and has two options input
and output
bowtie -i IsomiR_377G.txt -o IsomiR_377G.sam
Was thinking of something like:
for f in IsomiR_*.txt
do
bowtie -i "$f" -o "Output${f#IsomiR}"
done
I have similar problem with my awk function:
for f in IsomiR_*.txt
do
awk '{printf ">%s_%s\n %s\n",$1,$2,$1;}' "$f" > "Header${f#IsomiR}"
done
-bash: syntax error near unexpected token `>'