HELP converting filenames!
Brandon S. Allbery
allbery at NCoast.ORG
Fri Oct 13 10:10:34 AEST 1989
As quoted from <9754 at cadnetix.COM> by rusty at cadnetix.COM (Rusty Carruth):
+---------------
| In article <5003 at omepd.UUCP> merlyn at iwarp.intel.com (Randal Schwartz) writes:
| >In article <9234 at pyr.gatech.EDU>, david at pyr (David Brown) writes:
| >| Hiya. I have a friend who has about 200 files in a directory that are all
| >| upper case. They are data files that need to be in lower case, because
| >| his brain-dead program won't recognize upper case letters.
| >
| <solution requiring 'tr'>
|
| First, go to the directory of interest and do 'ls -1 > doit'.
| Chmod 777 doit. Now, go edit 'doit' (for all you emacs haters
| out there, sorry but emacs seems to work better for what I'm about
| to suggest than does vi) and make a macro (sorry folks, this
| trick will pretty much require emacs) which adds a space or two
+---------------
Nonsense.
vi: :1,$s/.*/mv & &/
emacs: M-X replace-regexp RET ^.*$ RET mv \& \& RET
You did, however, forget to switch the case on the second copy.
My usual way of doing it:
ls | sed 'h;y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/;x;G;s/\n/ /;s/^/mv /' | sh
(Usually, I do this twice, the first time with "echo" instead of "mv", so I
can make sure I didn't blow it. I just tested this, BTW; it works fine under
Xenix. Other OSes may vary, but it should work under standard System V's.)
++Brandon
--
Brandon S. Allbery, moderator of comp.sources.misc allbery at NCoast.ORG
uunet!hal.cwru.edu!ncoast!allbery ncoast!allbery at hal.cwru.edu
bsa at telotech.uucp, 161-7070 BALLBERY (MCI), ALLBERY (Delphi), B.ALLBERY (GEnie)
Is that enough addresses for you? no? then: allbery at uunet.UU.NET (c.s.misc)
More information about the Comp.unix.wizards
mailing list