adding file extensions to split output files

Hello,
I've searched this forum and others for a solution to my problem but nothing seems just right, I'm hoping I can get some help (seems like this should be easy, and I apologize if I've missed something on the forum):

I have several large .fastq DNA sequence files (~20million reads, 80million lines each) that I need to split for a time-consuming read merging step that will be parallelized. I am using:

split -l 5000000 QAT010_bar181_merge.fastq Bar181split_
split -l 5000000 QAT010_bar182_merge.fastq Bar182split_
etc.

with the output as Bar181split_aa, Bar181split_ab, Bar181split_ac, etc.

However, the next step MUST have input files with a .fastq extension, and I'm having trouble appending .fastq to all files beginning "Bar*". Any ideas?

thanks for helping!

Logan

cd /directory/to/files
for f in Bar*
do
  mv $f  ${f}.fastq
done

Have fun...

1 Like

Thanks Jim, I just figured this out as well (still quite new to this!)