View Single Post
Old 10-09-2019, 06:58 AM   #1
Marius
8armed
 
Location: Germany

Join Date: Dec 2010
Posts: 29
Default Remove a part of a filename in a Bash loop

I have many files named like this:

lib01.GFBAG_UHAU.fastq.sam.bam
lib02.ABABAB_ZU.fastq.sam.bam
lib03.ZGAZG_IAUDH.fastq.sam.bam

Many parts of the filenames are thus variable in length, although they are connected through the same type of punctuation (. or _).
What I want to achieve is to remove the part .fastq.sam.bam from a filename when I loop trough these files in BASH. How do I achieve this in Bash?
Marius is offline   Reply With Quote