Article View: comp.unix.shell
Article #1103Re: How to do mv *.xyz *.abc in shell script??
From: Tom Christiansen
Date: Fri, 07 Sep 1990 16:33
Date: Fri, 07 Sep 1990 16:33
22 lines
1121 bytes
1121 bytes
I still like this one (from the FAQ):
#!/usr/bin/perl
#
# rename script examples from lwall:
# rename 's/\.orig$//' *.orig
# rename 'y/A-Z/a-z/ unless /^Make/' *
# rename '$_ .= ".bad"' *.f
# rename 'print "$_: "; s/foo/bar/ if <stdin> =~ /^y/i' *
$op = shift;
for (@ARGV) {
$was = $_;
eval $op;
die $@ if $@;
(rename($was,$_) || warn "$0: can't rename $was to $_: $!\n")
if $was ne $_;
}
--
"UNIX was never designed to keep people from doing stupid things, because
that policy would also keep them from doing clever things." [Doug Gwyn]
Technical Details
Message-ID:
<105938@convex.convex.com>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!convex!convex.COMReferences:
<5569@minyos.xx.rmit.oz> <1990Sep7.130010.28853@cs.utk.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!convex!convex.COM From: tchrist@convex.COM (Tom Christiansen) Newsgroups: comp.unix.shell Subject: Re: How to do mv *.xyz *.abc in shell script?? Message-ID: <105938@convex.convex.com> Date: 7 Sep 90 16:33:28 GMT References: <5569@minyos.xx.rmit.oz> <1990Sep7.130010.28853@cs.utk.edu> Sender: news@convex.com Reply-To: tchrist@convex.COM (Tom Christiansen) Organization: CONVEX Software Development, Richardson, TX Lines: 22