Print

Print


Beware that 'rename' on Fedora/Redhat and the like works differently
from 'rename' on Debian/Ubuntu etc.  Both are in /usr/bin but the former
is an executable and the latter is a Perl script (it's apparently
installed with Perl), and is probably descended from your 'rename-alot'
(the syntax appears to be identical).

Personally I think the Debian/Perl version is much more powerful, i.e.
you can do anything that's allowed by the Perl regexp rules.  For
example the executable version only changes the *first* occurrence of a
search string, whereas with the 's/.../.../g' modifier you can change
multiple occurrences (assuming that's what you want of course!).

-- Ian

> -----Original Message-----
> From: [log in to unmask] 
> [mailto:[log in to unmask]] On Behalf Of Frank von Delft
> Sent: 12 March 2008 07:42
> To: James Stroud
> Cc: [log in to unmask]
> Subject: Re: [ccp4bb] changing names of many files
> 
> There's a dead-ordinary linux command 'rename':
> 
>  >> rename 1055 '' 1055*.osc
> 
> Saved my butt numerous times.
> phx.
> 
> James Stroud wrote:
> > 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
> 
> 


Disclaimer
This communication is confidential and may contain privileged information intended solely for the named addressee(s). It may not be used or disclosed except for the purpose for which it has been sent. If you are not the intended recipient you must not review, use, disclose, copy, distribute or take any action in reliance upon it. If you have received this communication in error, please notify Astex Therapeutics Ltd by emailing [log in to unmask] and destroy all copies of the message and any attached documents. 
Astex Therapeutics Ltd monitors, controls and protects all its messaging traffic in compliance with its corporate email policy. The Company accepts no liability or responsibility for any onward transmission or use of emails and attachments having left the Astex Therapeutics domain.  Unless expressly stated, opinions in this message are those of the individual sender and not of Astex Therapeutics Ltd. The recipient should check this email and any attachments for the presence of computer viruses. Astex Therapeutics Ltd accepts no liability for damage caused by any virus transmitted by this email. E-mail is susceptible to data corruption, interception, unauthorized amendment, and tampering, Astex Therapeutics Ltd only send and receive e-mails on the basis that the Company is not liable for any such alteration or any consequences thereof.
Astex Therapeutics Ltd., Registered in England at 436 Cambridge Science Park, Cambridge CB4 0QA under number 3751674