The way rename works is {{rename s/old/new/}}.  The period stands for any character.  If you precede the period with a backslash, it means a literal period.  The dollar sign means the end of the string (there can be nothing after it, so m4b, not m4b*).

Rename is described [here | http://tips.webdesign10.com/how-to-bulk-rename-files-in-linux-in-the-terminal]

!!!Changing Extensions

!!Linux

In Linux, for example, to rename *.m4b -> *.m4a

First, to see what will happen,

{{{
$ rename -n 's/\.m4b$/\.m4a/' *.m4b
}}}

then, if the results are satisfactory, run again without the -n extension.

!!Mac

On Mac, the rename command doesn't exist.  You can type following however to convert *.txt to *.xml

%%prettify 
{{{
for i in *.txt; do base=`basename "$i" .txt`; mv "$i" "$base".xml;done
}}}
/%

!!!Stripping from the front of the file name

iTunes sometimes puts the track number twice.  You end up with filenames like
{{{
01 01 Lord Hornblower.mp3
}}}
or
{{{
2-01 01 Post Captain.m4b
}}}

To fix this, run
{{{
$ rename 's/.. //' *.mp3
}}}
you will get
{{{
01 Lord Hornblower.mp3
}}}
and
{{{
2-01 01 Post Captain.m4b
}}}
What it actually does is strip the first space and two preceding characters.  So in "2-01 01", the first 01 and the following space are removed and the second 01 moves into its place.

!!! Change %20 to space in filenames

{{{
$ rename 's/.20/ /g' *mp3
}}}

----
[Linux.Shell | CategoryComputing.Linux.Shell] - [Mac.Shell | CategoryComputing.Mac.Shell]