home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / unix / question / 10221 < prev    next >
Encoding:
Text File  |  1992-08-20  |  1.1 KB  |  39 lines

  1. Newsgroups: comp.unix.questions
  2. Path: sparky!uunet!ftpbox!mothost!merlin.dev.cdx.mot.com!fendahl.dev.cdx.mot.com!mcook
  3. From: mcook@fendahl.dev.cdx.mot.com (Michael Cook)
  4. Subject: Re: Changing file names
  5. Message-ID: <mcook.714323667@fendahl.dev.cdx.mot.com>
  6. Sender: news@merlin.dev.cdx.mot.com (USENET News System)
  7. Nntp-Posting-Host: fendahl.dev.cdx.mot.com
  8. Organization: Motorola Codex, Canton, Massachusetts
  9. References: <ac#n06l.bosak@netcom.com> <ceYpFNG00VoxBKON4O@andrew.cmu.edu>
  10. Date: Thu, 20 Aug 1992 15:14:27 GMT
  11. Lines: 26
  12.  
  13. jf41+@andrew.cmu.edu (Jonathan R. Ferro) writes:
  14.  
  15. >bosak@netcom.com (Jon Bosak) writes:
  16. >> [ file name conversion: xyz920815a ==> 920815a ]
  17. >>
  18. >> Who can provide the most elegant solution using just the basic Unix
  19. >> tools (cp, mv, sed, awk, sh, csh)?
  20.  
  21. >Put this in your bin directory under the name 'rename':
  22. >----------
  23. >#!/usr/local/bin/perl
  24.  
  25. ...
  26.  
  27. >and use the command:
  28.  
  29. >% rename 's/^xyz//' xyz*
  30.  
  31. A similar solution:
  32.  
  33.   ls xyz* | sed 's/xyz\(.*\)/mv & \1/' | sh
  34.  
  35. which is more to type, but doesn't require that you have anything fancier than
  36. ls, sed, sh and mv.
  37.  
  38. Michael.
  39.