The attached rename.pl is invaluable for such tasks.
Use it exactly like your bash rename attempt. You can use pretty much any perl in-place-modifier construct - s/X/Y/, tr/A-Z/a-z/ (upper->lower), etc.
Not sure where I found this originally, but it's extremely handy.
#!/usr/bin/perl
if (@ARGV == 0) { die "usage: rename PATTERN FILESPEC\n"; }
$pattern=shift;
foreach (@ARGV) { my $oldname=$_; my $newname=$_; eval ("\$newname=~$pattern"); rename($oldname, $newname); }
Very. Thanks. Not a BASH script, but works great.
Thanks.
- : send the line "unsubscribe linux-admin" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html