Print

Print


I don't know where this comes from, but its called rename-alot. Its a  
perl script. I'm guessing "Larry" is Larry Wall, but who knows. chmod a 
+x it and then put it in your path (~/bin)

You run it like this

rename-alot 's/1105 A/A/' *.osc

The above will change all files that look like this: "1105 A0176.osc"  
to this "A0176.osc".

The script is everything between, but not including, the equals signs.  
Your system probably has perl on it unless you are running Mac OS 9 or  
prior or any version of Windows.

==
#!/usr/bin/perl -w
# rename - Larry's filename fixer
$op = shift or die "Usage: rename-alot expr [files]\n" .
                    "eg:  % rename-alot \'s/abc /abc-/\' abc*txt\n" ;

chomp(@ARGV = <STDIN>) unless @ARGV;
for (@ARGV) {
     $was = $_;
     eval $op;
     die $@ if $@;
     rename($was,$_) unless $was eq $_;
}
==


James


On Mar 11, 2008, at 6:32 PM, Raja Dey wrote:

> Hi,
> How I can change names of many files keeping the extension same. My  
> files are like this
>
> 1105 A0176.osc
> 1105 A0177.osc
> 1105 A0178.osc
> 1105 A0179.osc
> 1105 A0180.osc
>
> I want to change them as
>
> A0176.osc
> A0177.osc
> A0178.osc
> A0179.osc
> A0180.osc
>
> I am using ubuntu linux.
>
> Thanks...
> RD
>
>
>
> Raja Dey, Ph.D.
> Research Associate
> Molecular and Computational Biology
> University of Southern California
> 1050 Childs Way, Los Angeles, CA 90089
> Chat on a cool, new interface. No download required. Click here.

--
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA  90095

http://www.jamesstroud.com