I wish to remove the middle of filenames that look like the following:
Wm-no-Bis.GAGATTCC-ATAGAGGC.L001.R1.001.fastq.trim.R2.fastq
Pek-no-Bis.GAGATTCC-AGGCGAAG.L001.R1.001.fastq.trim.R1.fastq
To Get
Wm-no-Bis.trim.R2.fastq
Pek-no-Bis.trim.R1.fastq
As you can see the beginning and end of the files are slightly variable. I have attempted to use rename as follows:
rename 's/.*.*.*.*.*.trim.//g'
Wm-no-Bis.GAGATTCC-ATAGAGGC.L001.R1.001.fastq.trim.R2copy.fastq
This removes the entire file name except for the end. The issue is obviously my lack of understanding how to use wildcards.
try
source
You can use this
rename
command:When you're happy with output then remove
-n
option (dry-run)