home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.unix.questions
- Path: sparky!uunet!ftpbox!mothost!merlin.dev.cdx.mot.com!fendahl.dev.cdx.mot.com!mcook
- From: mcook@fendahl.dev.cdx.mot.com (Michael Cook)
- Subject: Re: Changing file names
- Message-ID: <mcook.714323667@fendahl.dev.cdx.mot.com>
- Sender: news@merlin.dev.cdx.mot.com (USENET News System)
- Nntp-Posting-Host: fendahl.dev.cdx.mot.com
- Organization: Motorola Codex, Canton, Massachusetts
- References: <ac#n06l.bosak@netcom.com> <ceYpFNG00VoxBKON4O@andrew.cmu.edu>
- Date: Thu, 20 Aug 1992 15:14:27 GMT
- Lines: 26
-
- jf41+@andrew.cmu.edu (Jonathan R. Ferro) writes:
-
- >bosak@netcom.com (Jon Bosak) writes:
- >> [ file name conversion: xyz920815a ==> 920815a ]
- >>
- >> Who can provide the most elegant solution using just the basic Unix
- >> tools (cp, mv, sed, awk, sh, csh)?
-
- >Put this in your bin directory under the name 'rename':
- >----------
- >#!/usr/local/bin/perl
-
- ...
-
- >and use the command:
-
- >% rename 's/^xyz//' xyz*
-
- A similar solution:
-
- ls xyz* | sed 's/xyz\(.*\)/mv & \1/' | sh
-
- which is more to type, but doesn't require that you have anything fancier than
- ls, sed, sh and mv.
-
- Michael.
-