![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
bash loop to count multiple words from multiple corresponding files | chayan | Bioinformatics | 1 | 05-10-2019 04:24 AM |
How do I remove a part of the header of a fasta file in perl? | Katty1 | Bioinformatics | 3 | 05-13-2016 08:11 AM |
For loop in bash terminal to concatenate fastq files | rcook34 | Bioinformatics | 6 | 02-04-2016 08:41 PM |
how to use bash script to make iterative loop through directory with two file types | jddavis | Bioinformatics | 2 | 05-23-2013 08:02 AM |
BFAST fasta2brg -f filename | kursuni | Bioinformatics | 0 | 05-10-2011 12:59 PM |
![]() |
|
Thread Tools |
![]() |
#1 |
8armed
Location: Germany Join Date: Dec 2010
Posts: 29
|
![]()
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? |
![]() |
![]() |
![]() |
#2 |
Registered Vendor
Location: Eugene, OR Join Date: May 2013
Posts: 521
|
![]()
You want to split the string on a "." delimiter and then keep the first two parts. Or use ".fastq.sam.bam" as a delimiter, I suppose!
https://www.tutorialkart.com/bash-sh...-split-string/
__________________
Providing nextRAD genotyping and PacBio sequencing services. http://snpsaurus.com |
![]() |
![]() |
![]() |
#3 |
Junior Member
Location: Korea Join Date: Mar 2013
Posts: 1
|
![]()
Refer to https://unix.stackexchange.com/quest...ck-of-variable
An example for changing extension from fastq.sam.bam to txt. for file in *.fastq.sam.bam do mv ${file%.fastq.sam.bam} ${file%.fastq.sam.bam}.txt done |
![]() |
![]() |
![]() |
#4 | |
Senior Member
Location: Purdue University, West Lafayette, Indiana Join Date: Aug 2008
Posts: 2,317
|
![]() Quote:
for file in *.fastq.sam.bam do mv $file ${file%.fastq.sam.bam}.txt done -- Phillip |
|
![]() |
![]() |
![]() |
Thread Tools | |
|
|