Trying to edit the name of files to be used as input in bash scripting

31 views Asked by At

I am trying multiple files that look like this:

k27.contigs.fa; where the value (e.g. 27) differs

I am trying to write a for loop for a function for each of my file, and the functions looks like:

megahit_toolkit contig2fastg 99 k99.contigs.fa > k99.fastg

for x in *.contigs.fa
do 
   megahit_toolkit contig2fastg ${x%.contings.fa*} $x > ${x%.contings.fa*}.fastg
done

How do I modify the code so that I can replace the number and ignore the k before that?

0

There are 0 answers