On 10/06/2011 10:35 AM, Csanyi Pal wrote:
> Hi,
>
> I have a directory with filenames as follows:
>
> PIC00001.JPG
> PIC00002.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...JPG/PIC00199.JPG/' *
> PIC00001.JPG renamed as PIC00199.JPG
> PIC00002.JPG renamed as PIC00199.JPG
>  ..
> PIC00001.JPG renamed as PIC00199.JPG
>
> The -n option is here for No Action: show what files would have been
> renamed. 
>
> So how can I increase numbers in filenames in perl expression to get:
> PIC00199.JPG
> PIC00200.JPG
>  ..
> PIC00234.JPG
>
> ??

Something like

rename -n 's/(\d+)/$1+198/e' *.JPG

should do the trick, but note that it might match other files.

> Where can I study perl expressions?

man perl


-- 
BOFH excuse #289:

Interference between the keyboard and the chair.

Eduardo M KALINOWSKI
edua...@kalinowski.com.br


-- 
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/4e8db2fa.1080...@kalinowski.com.br

Reply via email to