[lug] Perl question

Ken Weinert kweinert at earthlink.net
Fri Mar 31 15:00:54 MST 2000

* Bob Collins (bcollins at csd.net) [000331 14:50]:
> I have a number files I want to rename to lower case, so I went my "Perl
> Cookbook" and found exactly what I needed, "rename" on page 327 in my
> book.  The "rename" script is sent as an attachment.  The script can be
> executed as:
> rename 'tr/A-Z/a-z/ unless /^Make/' *
> This should change files to lowercase.  If you understand the " unless
> /^Make/ " part I would be interested in an explanation.

        Well, I can help on the "unless" part - on unix the name
of the makefile is typically Makefile, with the leading capitalization
in order to make it sort toward the start of a directory listing.

        I'm not a perl guru, no matter how you stretch your imagination,
but I think you were executing it wrong - you didn't want AB.c ab.c -
you aren't telling it what to rename it, just giving it a pattern to

        Maybe I just misunderstood what you wrote in your email :-), but
I think all you'd need is "perl -d name AB.c" and that one file would
get renamed. If you type "perl -d name *" then all the files would get
renamed to their lowercase version (except Makefiles, of course.)

Ken Weinert   kweinert at earthlink.net 303-858-6956 (V) 978-336-5652 (F)
PGP: DF 2B 6C 72 33 BE 06 D1  9D C4 ED 32 36 97 C0 6E

More information about the LUG mailing list