Wednesday, March 24, 2010

Mitch's list of really incredibly useful commands...

This thread is simply a list of commands that I use from time to time, which are really useful, but long enough that I won't remember them when I need them.

Please note: for the rename examples below to work, you must be using the Perl version of rename, such as the one included in Debian (and derivative) distributions. The Redhat Enterprise Linux version of rename is different and is almost useless.

Rename files to add leading zeros (in this case followed by a letter)
Code:
$rename -nv 's/^([1-9])([a-z])/0$1$2/' /mydir/*

note: remove the 'n' argument to actually change the filenames.

in reference to:

"This thread is simply a list of commands that I use from time to time, which are really useful, but long enough that I won't remember them when I need them.Please note: for the rename examples below to work, you must be using the Perl version of rename, such as the one included in Debian (and derivative) distributions. The Redhat Enterprise Linux version of rename is different and is almost useless.Rename files to add leading zeros (in this case followed by a letter)"
- Ithaca Free Software GNU Linux • View topic - Mitch's list of really incredibly useful commands... (view on Google Sidewiki)

No comments: