I have a following list of files;
11F.fastq.gz
11R.fastq.gz
12F.fastq.gz
12R.fastq.gz
I'd like to rename these file names to the following;
11_S11_L001_R1_001.fastq.gz
11_S11_L001_R2_001.fastq.gz
12_S12_L001_R1_001.fastq.gz
12_S12_L001_R2_001.fastq.gz
I tried reanme
as follows
rename 's/F.fastq/_S_L001_R1_001.fastq/' *.gz
rename 's/R.fastq/_S_L001_R2_001.fastq./' *.gz
but I dont quite know how to add file numbers (11 and 12 in this case) after "S". Any pointers will be appreciated.
for
loop for that – mashuptwice Feb 28 '22 at 15:53