I have various files that are names
"type_featAtype_featB"
and
"type_featAtype_featC"
I need that all
"type_featA"
are replaced with
"START"
so the new names of the folders would be called
"STARTtype_featB"
and
STARTtype_featC"
.
I have been looking at the rename function here and here
However, not all of my files have the same suffix, in fact they all have different suffixes as indicated in the example.
Thus, I am looking for insight on how to use a command to replace just a part of the file name, as indicated above in one folder where each file had a unique suffix. Thank you
Thank you in advance for any help.
A more cryptic option would be to use SED - I suppose that you would choose to do this if you had no access to the perl rename function (which I admit is more concise, and more clear):
ls * | sed -e 'p;s/^type_featA/START/' | xargs -n2 mv
Assuming you have the rename
utility that is a part of perl distribution, you could say:
rename 's/^type_featA/START/' *
to achieve the desired result.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With