Renaming all files in a folder_adding a part to it

45 Views Asked by At

I have several MAGs named as follows in a folder.

bin.10.fa bin.14.fa bin.17.fa bin.1.fa bin.24.fa bin.27.fa bin.2.fa bin.32.fa bin.35.fa bin.3.fa bin.44.fa bin.48.fa bin.50.fa bin.54.fa bin.7.fa

I would like to rename it to b3_bin,x.fa, where x is the number from original file.

How can i do this on terminal ?

i tried rename

rename -v 's/bin.x.fa/b3_bin.x.fa /zfs/camplab/Jojy/darpa_working/drep_mags_all/b3_renamed/b3.bin.x.fa/*.x.fa

it failed. it showed running, but no output

0

There are 0 best solutions below