Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!wasatch!cs.utexas.edu!uunet!auspex!guy From: guy@auspex.auspex.com (Guy Harris) Newsgroups: comp.unix.questions Subject: Re: moving upper case names to lower case Message-ID: <2381@auspex.auspex.com> Date: 23 Aug 89 18:26:29 GMT References: <20672@adm.BRL.MIL> <9326@chinet.chi.il.us> Reply-To: guy@auspex.auspex.com (Guy Harris) Organization: Auspex Systems, Santa Clara Lines: 47 >It's easier to write and compile this than to get tr to massage >the string for you. Well, maybe, but I really tend to doubt it. The algorithm for finding the right "tr" command is: if (you have S3 or S5 (or V6?)) use the command tr '[A-Z]' '[a-z]' else /* you have V7 or 2.xBSD or 4.xBSD */ use the command tr 'A-Z' 'a-z' which strikes *me* as being easier than typing in and compiling said program (fewer characters, for one thing!). And there's even an optimization; given the way the V7/2.xBSD/4.xBSD "tr" parses its arguments, the command tr '[A-Z]' '[a-z]' will do the right thing (it will translate '[' to '[' and ']' to ']', as well as translating upper-case letters to lower-case letters; this trick does *not* work in general, though, since '[' and ']' don't have special meaning to the V7/2.xBSD/4.xBSD "tr"). In either case, of course, you have to feed the file names to this program, extract the file names out the other end, and use them in an "mv" command, which strikes me as more work than just getting the translation done. Once you've gotten the list of file names, I would be tempted to try: for i in # note - is not to be typed # literally; it's the list of file names do mv $i `echo $i | ` done where is the "tr" command in question (or, if you're really insistent, the case-translation program supplied). (Said "for" construct is, of course, a Bourne shell construct, so if your login shell is the C shell you'd either have to 1) use the C shell equivalent or 2) type "sh" before typing in the construct; the C shell equivalent is left as an exercise for the reader.)