pattern matching rename...

bruce bedouglas at earthlink.net
Thu Dec 28 17:47:57 UTC 2006


thanks todd...

at the risk of asking a rather basic question.. can someone explain exactly
what/why this seesm to work..

per your reply, i have :

 abcCAT.py
 abcCAT.txt

 i'd like to rename the files, so i get
 abcCAT_dog.py
 abcCAT_dog.txt

 i've been trying to figure out how to achieve what i want using
 rename and pattern matching.. i'm missing something.. and it's
 simple!!

 any thoughts/pointers?
$ rename . _dog. abcCAT.*
 ls abcCAT*
abcCAT_dog.py  abcCAT_dog.txt

this works. but i can't find any docs that give a good explanation of
how/why this works.

it appears that the rename is taking the "_dog" and adding it to the
"abcCAT"... but how would i know that this is going to occur.. is this
really what's going on.. what if i wanted to have the "_dog" added before
the abcCAT...

in searching the net (google) couldn't really find any good docs for this..

i was also under the impression that 'rename' could use regex's but i can't
figure out how..

thanks



-----Original Message-----
From: fedora-list-bounces at redhat.com
[mailto:fedora-list-bounces at redhat.com]On Behalf Of Todd Zullinger
Sent: Thursday, December 28, 2006 8:55 AM
To: fedora-list at redhat.com
Subject: Re: pattern matching rename...


bruce wrote:
> i have the following as a test...
>
> abcCAT.py
> abcCAT.txt
>
> i'd like to rename the files, so i get
> abcCAT_dog.py
> abcCAT_dog.txt
>
> i've been trying to figure out how to achieve what i want using
> rename and pattern matching.. i'm missing something.. and it's
> simple!!
>
> any thoughts/pointers?

$ rename . _dog. abcCAT.*
$ ls abcCAT*
abcCAT_dog.py  abcCAT_dog.txt

Beware that there are different programs named rename on different
distros.

--
Todd        OpenPGP -> KeyID: 0xBEAF0CE3 | URL: www.pobox.com/~tmz/pgp
======================================================================
I believe in the noble, aristocratic art of doing absolutely nothing.
And someday, I hope to be in a position where I can do even less.





More information about the fedora-list mailing list