home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.unix.questions
- Path: sparky!uunet!psinntp!rlyeh.multisys.com!rot
- From: rot@multisys.com (Republic of Taiwan)
- Subject: Re: need script to rename uppercase filenames
- Message-ID: <Bu74sM.Hxz@multisys.com>
- Keywords: script,tar,msdos
- Organization: Multimedia Information Systems Corporation, San Jose, CA TEL: (408) 436-8929 E-mail: info@multisys.com
- References: <699@svcs1.UUCP>
- Date: Mon, 7 Sep 1992 07:00:22 GMT
- Lines: 28
-
- In article <699@svcs1.UUCP> slix@svcs1.UUCP (Bill Miller) writes:
- =Hi, everyone.
- =
- =I'm fairly new to unix, and I need a script or procedure to do the following:
- =
- =I have some source code in DOS (many separate files) that I tarred under
- =DOS and untarred under 386BSD. The big problem is that all the files
- =came through in UPPERCASE and I need a script to mv (rename) them all
- =to lowercase quickly.
- =
- =Since they're in DOS text format, I realize I also need to strip the
- =extra carriage returns on each line. I've been successful in doing this
- =with:
- =
- = cat (file) | tr -d '\015' > (newfile)
- =
- =It would be nice to combine both of these so that I could rename the
- =files to uppercase and strip the extra newlines all in one fell swoop
- =instead of doing it one file at a time.
- =
-
- #!/bin/csh -f
- # ^M is contrl M, ^Z is control Z
- #
- foreach i ($*)
- sed -e 's/^M//g' -e 's/^Z//g' $i > `echo $i | tr A-Z a-z`;
- rm $i;
- end
-