home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!dtix!darwin.sura.net!convex!convex!tchrist
- From: tchrist@convex.COM (Tom Christiansen)
- Newsgroups: comp.unix.questions
- Subject: Re: Changing file names
- Message-ID: <1992Aug21.135128.20589@news.eng.convex.com>
- Date: 21 Aug 92 13:51:28 GMT
- References: <ac#n06l.bosak@netcom.com> <31810002@hpcuhe.cup.hp.com>
- Sender: usenet@news.eng.convex.com (news access account)
- Reply-To: tchrist@convex.COM (Tom Christiansen)
- Organization: Convex Computer Corporation, Colorado Springs, CO
- Lines: 35
- Originator: tchrist@pixel.convex.com
- Nntp-Posting-Host: pixel.convex.com
- X-Disclaimer: This message was written by a user at CONVEX Computer
- Corp. The opinions expressed are those of the user and
- not necessarily those of CONVEX.
-
- From the keyboard of srini@hpcuhe.cup.hp.com (Sreenivasa R Tellakula[C]):
- :following script should be able to change file names
- :
- :#!/bin/ksh
-
- The 'k' above is superfluous. If you're going to use
- ksh, use its special syntax for this, like
-
- for file in xyz* ; do
- mv $file ${file#xyz}
- done
-
- :for i in `ls`
- :do
- : echo $i | sed s/xyz// >j
- : mv $i `cat j`
- :done
- :rm j
-
- Process pig. Why not
-
- mv $i `echo $i | sed 's/^xyz//'`
-
- Also, your method is going to earn you a lot of
-
- mv: foo and foo are identical
-
- errors.
-
- --tom
- --
- Tom Christiansen tchrist@convex.com convex!tchrist
-
- "UNIX was not designed to stop you from doing stupid things, because
- that would also stop you from doing clever things." -- Doug Gwyn
-