0

within workdir I have many filles with the names in the following format:

7000_grid12_10_lig_cne_767_lig.dlg

I need one line sed (or other shell utility) expression suitable to substitute _grid12_ to _ , so the filename become

7000_10_lig_cne_767_lig.dlg

I've tried to use rename for all filles but it did not work (verbose found nothing)

rename -v 's/_grid12_/_/' *.dlg

1 Answers1

2

You can use perl-rename (there is another program called rename which is a part of util-linux package):

perl-rename 's,_grid12_,_,' *

You don't even need a loop as perl-rename will rename all files in the current directory.