View Single Post
Old 10-11-2019, 08:25 AM   #4
pmiguel
Senior Member
 
Location: Purdue University, West Lafayette, Indiana

Join Date: Aug 2008
Posts: 2,317
Default

Quote:
Originally Posted by ungsik View Post
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
Don't you mean:

for file in *.fastq.sam.bam
do
mv $file ${file%.fastq.sam.bam}.txt
done

--
Phillip
pmiguel is offline   Reply With Quote