home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / unix / question / 10799 < prev    next >
Encoding:
Text File  |  1992-09-08  |  1.4 KB  |  40 lines

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