the rename command

Arnold Maestre arnold.maestre at gmail.com
Thu Nov 25 13:29:34 UTC 2004


On Thu, 25 Nov 2004 07:25:33 -0500, Archie Benton
<archie.benton at gmail.com> wrote:
> I'm an ex-redhat/fedora user. The rename command was simple over in
> fedora.  When I try to use it in Ubuntu it expects me to enter a perl
> expression. I'm not sure I'm ready to learn perl or even "regular
> expressions". I'm just trying to rename a bunch of files. For example
> let's say I have cow1.txt, cow2.txt and cow3.txt in a subdirectory. I
> just want to rename them all to pig1.txt, pig2.txt and pig3.txt. The
> man page on the rename command expects me to put a perl expression in.
> Ugh. Any way around this? I've tried to "read the man".

In your case the regular expression would look like "s/cow/pig/g",
meaning that you want to [s]ubstitute occurences of "cow" with "pig"
[g]lobally. Google "regular expressions" for a more detailed answer.
-- 
Arnold Maestre




More information about the ubuntu-users mailing list