1

so I want to batch change name files with these type of names (about 400 files):

L1_Mviridis.fasta
L2_Mviridis.fasta
L3_Mviridis.fasta...

to this:

L1_1_Mviridis.fasta
L2_2_Mviridis.fasta
L3_3_Mviridis.fasta

I do not have the function "rename" available either. Thanks for any suggestion!

1 Answers1

0

you have two choices I suggest you can write a python script to rename each file first you split() function to split the underscore and extract the number the question is not that clear

Rename multiple files in a directory in Python

there is already an answer here also

Or you can use the mv command to rename mv <old name> <new name> and write a bash script to rename each one you can use sed or awk to rename each file

you can chain command for example ls -la | awk you can use for loop to iterate ls -l below is the guide to shell scripting

http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO-7.html

there is already an answer here BASH: Rename multiple files. But only rename part of the filename

I hope this is a good starting point to you

Hamuel
  • 633
  • 5
  • 16