I have this directory, and want to rename the files:
===> ls -1 Der-vierte-Weise/
10 - 10 - Erkenntniss.ogg
1 - 01 - Hoffnung.ogg
11 - 11 - Wahrheit.ogg
12 - 12 - Dankbarkeit.ogg
13 - 13 - Kredits.ogg
2 - 02 - Familie.ogg
3 - 03 - Demut.ogg
4 - 04 - Freude.ogg
5 - 05 - Schoenheit.ogg
6 - 06 - Solidaritaet.ogg
7 - 07 - Entscheidung.ogg
8 - 08 - Hilfe.ogg
9 - 09 - Unterstuetzung.ogg
The result should look like this:
===> ls -1 Der-vierte-Weise/
01 - Hoffnung.ogg
02 - Familie.ogg
...
I would like to solve this with common shell tools.
You could use
rename
...Remove
-n
after testing to actually rename the filesExplanation
s/old/new/
replaceold
withnew
^
start of string[0-9]+
some numbersbash
parameter expansion to strip off the required portion from start:Expanded form:
echo
is for dry-running; get rid of it for actual action:Example: