-3

how I can rename several files (Q0138-9061933666_S5.fasta.db) in a folder and leave only the no as ca (Q0138-9061933666_S5.db) i.e. delete .fasta from all files

1 Answers1

0

Assuming you are in the folder where the files are placed.

for i in *.fasta.db
do
    mv $i ${i/\.fasta/} # remove "fasta" from file name
done             

See Replace one substring for another string in shell script for details about string substitution

flappix
  • 2,038
  • 17
  • 28