Reduce FASTA file name
2
I have more than 60000 fasta file and which having long name like
BA000031.2_ID= gene0_Name= VP0001_gbkey= Gene_gene= VP0001_gene_biotype= protein_coding.fasta
BA000031.2_ID= gene8_Name= VP0009_gbkey= Gene_gene= VP0009_gene_biotype= protein_coding.fasta
and I want to change like this
VP0001.fasta
VP0009.fasta
like this for all 60000 files how it possible
perl
awk
fasta
genome
• 1.7k views
•
link
updated 4.1 years ago by
Ram
45k
•
written 9.5 years ago by
Eva_Maria
▴
190
Use the rename command. Check man rename for available options (rename comes with perl and newer perls have more options).
I'm sure there's an elegant awk solution out there but here's my somewhat shitty loop for it. It assumes all files keep the same structure as the ones you've posted.
for f in *_coding.fasta; do new= "$( echo $f | tr '=' '_' | cut -d '_' -f 5) " ; mv $f $new .fasta; done
•
link
updated 5.6 years ago by
Ram
45k
•
written 9.5 years ago by
Jenez
▴
540
Login before adding your answer.
Traffic: 1950 users visited in the last hour