[ILUG] Shell substitute regexp

kevin lyda kevin at suberic.net
Tue Jul 24 22:14:05 IST 2001


On Tue, Jul 24, 2001 at 07:41:19AM -0500, Stephen_Reilly at dell.com wrote:
> rename is a strange fish ...
> 
> [root at fragile tst1]# touch 1.dat 2.dat 3.dat 4.dat
> [root at fragile tst1]# ls
> 1.dat 2.dat 3.dat 4.dat
> [root at fragile tst1]# rename *.dat *

read man page.  you want:

    rename .dat '' *.dat

in what you typed, these are the args rename saw (assuming only the
files you touched are in tst1:

    rename 1.dat 2.dat 3.dat 4.dat 1.dat 2.dat 3.dat 4.dat

which replaces the first string that matches "1.dat" to "2.dat" for the
files 3.dat 4.dat 1.dat 2.dat 3.dat 4.dat.

kevin

-- 
kevin at suberic.net          simple four line sigs -
fork()'ed on 37058400      bandwidth friendly; nice to do.
meatspace place: home      some admins clueless.
http://suberic.net/~kevin          --netiquette haiku 2001




More information about the ILUG mailing list