Re: Renaming files with rename and perl expression

2011-10-06 Thread Brad Rogers
On Thu, 06 Oct 2011 10:57:51 -0300 Eduardo M KALINOWSKI wrote: Hello Eduardo, > That looses the trailing zeroes. Try this: ITYM leading. -- Regards _ / ) "The blindingly obvious is / _)radnever immediately apparent" Walking through town is quite scary I Pr

Re: Renaming files with rename and perl expression

2011-10-06 Thread Mike McClain
On Thu, Oct 06, 2011 at 03:35:48PM +0200, Csanyi Pal wrote: > Hi, > > Where can I study perl expressions? subscribe to beginn...@perl.org mailing list. perldoc perlre perldoc perlretut Happing perling, Mike -- Satisfied user of Linux since 1997. O< ascii ribbon campaign - stop html mail - www

Re: Renaming files with rename and perl expression

2011-10-06 Thread Csanyi Pal
Eduardo M KALINOWSKI writes: > On 10/06/2011 10:54 AM, Eduardo M KALINOWSKI wrote: >> >> Something like >> >> rename -n 's/(\d+)/$1+198/e' *.JPG >> >> should do the trick, but note that it might match other files. > > That looses the trailing zeroes. Try this: > > rename -n 's/(\d+)/sprintf("%05d

Re: Renaming files with rename and perl expression

2011-10-06 Thread Darac Marjal
On Thu, Oct 06, 2011 at 03:35:48PM +0200, Csanyi Pal wrote: > Hi, > > I have a directory with filenames as follows: > [cut] I think what you need is something a little more than just s///. rename will take any perl expression, which, as the man page says, is expected to rename $_ (which is a per

Re: Renaming files with rename and perl expression

2011-10-06 Thread Eduardo M KALINOWSKI
On 10/06/2011 10:54 AM, Eduardo M KALINOWSKI wrote: > > Something like > > rename -n 's/(\d+)/$1+198/e' *.JPG > > should do the trick, but note that it might match other files. That looses the trailing zeroes. Try this: rename -n 's/(\d+)/sprintf("%05d", $1+198)/e' *.JPG -- poverty, n.:

Re: Renaming files with rename and perl expression

2011-10-06 Thread Eduardo M KALINOWSKI
On 10/06/2011 10:35 AM, Csanyi Pal wrote: > Hi, > > I have a directory with filenames as follows: > > PIC1.JPG > PIC2.JPG > .. > PIC00036.JPG > > I want to get renamed those to > PIC00199.JPG > PIC00200.JPG > .. > PIC00234.JPG > > I'm trying to use for this the 'rename' command with perl

Renaming files with rename and perl expression

2011-10-06 Thread Csanyi Pal
Hi, I have a directory with filenames as follows: PIC1.JPG PIC2.JPG .. PIC00036.JPG I want to get renamed those to PIC00199.JPG PIC00200.JPG .. PIC00234.JPG I'm trying to use for this the 'rename' command with perl expression, but sofar I'm here with the command: rename -n 's/PIC000..