Please anyone.
How do I in Linux rename a bunch of files like:
abc-def-0001.xxx acb-def-0002.xxx
to:
abc-def##0001.xxx ...
I have tried several suggestions from SO like:
rename 's/(.*)-/$1##/' *.xxx
But didn’t worked as expected in my environment.
Advertisement
Answer
So I ended up using:
for i in *; do mv "$i" "`echo $i | sed "s/(.*)-/1##/"`"; done
I think my version of the rename command does not support the perl expressions…