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 `>'
-q/-svs.-i/-o) and shown an example of the command which is different to the files you've listed. What would the exact command be for the first file in your list? It seems like you're on the right lines with bash's string manipulation; where exactly are you stuck?IsomiR_377G.txttoinput1.txt?