regexp for rename command - please help!

2010-02-20 Thread Vadkan Jozsef
The filename, that i want to rename:

---vol.-01-disk-cantatas-bwv-3;

commands, that doesn't work:

$ rename 's/^---//g' *
Unknown option: -vol.-01-disk-cantatas-bwv-3;
Usage: rename [-v] [-n] [-f] perlexpr [filenames]


$ rename 's/.-/-/g' *
Unknown option: -vol.-01-disk-cantatas-bwv-3;
Usage: rename [-v] [-n] [-f] perlexpr [filenames]


$ rename 's/;$//g' *
Unknown option: -vol.-01-disk-cantatas-bwv-3;
Usage: rename [-v] [-n] [-f] perlexpr [filenames]


What is the regexp to get this filename?:

vol-01-disk-cantatas-bwv-3

Thank you:)


-- 
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/1266677069.6612.0.ca...@ubuntu



Re: regexp for rename command - please help!

2010-02-20 Thread Camaleón
On Sat, 20 Feb 2010 15:44:29 +0100, Vadkan Jozsef wrote:

 The filename, that i want to rename:
 
 ---vol.-01-disk-cantatas-bwv-3;

(...)

 What is the regexp to get this filename?:
 
 vol-01-disk-cantatas-bwv-3

After some attemps (:-P)...

***
s...@stt008:~/Desktop$ rename -n s/---vol./vol/ 
$HOME/Desktop/---vol.-01-disk-cantatas-bwv-3
/home/sm01/Desktop/---vol.-01-disk-cantatas-bwv-3 renamed as 
/home/sm01/Desktop/vol-01-disk-cantatas-bwv-3
***

Greetings,

-- 
Camaleón


-- 
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/pan.2010.02.20.15.11...@gmail.com



Re: regexp for rename command - please help!

2010-02-20 Thread Stephen Powell
On Sat, 20 Feb 2010 09:44:29 -0500 (EST), Vadkan Jozsef wrote:
 
 The filename, that i want to rename:
 
 ---vol.-01-disk-cantatas-bwv-3;
 
 commands, that doesn't work:
 
 $ rename 's/^---//g' *
 Unknown option: -vol.-01-disk-cantatas-bwv-3;
 Usage: rename [-v] [-n] [-f] perlexpr [filenames]
 
 
 $ rename 's/.-/-/g' *
 Unknown option: -vol.-01-disk-cantatas-bwv-3;
 Usage: rename [-v] [-n] [-f] perlexpr [filenames]
 
 
 $ rename 's/;$//g' *
 Unknown option: -vol.-01-disk-cantatas-bwv-3;
 Usage: rename [-v] [-n] [-f] perlexpr [filenames]
 
 
 What is the regexp to get this filename?:
 
 vol-01-disk-cantatas-bwv-3
 
 Thank you:)

I guess I'm not really sure what you want, but if all you want
to do is rename

   ---vol.-01-disk-cantatas-bwv-3;

to

   vol-01-disk-cantatas-bwv-3

The command is

   mv -- ---vol.-01-disk-cantatas-bwv-3\; vol-01-disk-cantatas-bwv-3

Two things are significant.  First, the double hyphen (--) after mv
tells mv that this is the end of the options list and anything after
it that starts with a hyphen is to be interpreted as a command
argument instead of a command option.  Second, the backslash (\) in front
of the semicolon (;) causes the semicolon to be interpreted by the shell
as part of the filename and not as a command separator.  Normally,
the semicolon is used to separate multiple commands on a single line.


-- 
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/500651757.13824951266679323475.javamail.r...@md01.wow.synacor.com



Re: regexp for rename command - please help!

2010-02-20 Thread Jörg-Volker Peetz
The problem is not the syntax of rename but the name of the files beginning with
'-'. So try something like

$ rename 's/^---//g' ./*

where the shell  expands the filenames to ./---vol1 ./---vol2  Then the
rename command doesn't interpret the filenames as switches.
-- 
Regards,
Jörg-Volker.


-- 
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/hlpb22$ki...@ger.gmane.org



Re: regexp for rename command - please help!

2010-02-20 Thread Jörg-Volker Peetz
(Sorry, forgot to adapt the regular expression in my previous mail.)
The problem is not the syntax of rename but the name of the files beginning with
'-'. So try something like

$ rename 's|^\./---||g' ./*

where the shell  expands the filenames to ./---vol1 ./---vol2  Then the
rename command doesn't interpret the filenames as switches.
-- 
Regards,
Jörg-Volker.


-- 
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/hlpboh$ki...@ger.gmane.org



Re: regexp for rename command - please help!

2010-02-20 Thread Chris Burkhardt
Vadkan Jozsef wrote:
 The filename, that i want to rename:
 
 ---vol.-01-disk-cantatas-bwv-3;
 
 commands, that doesn't work:
 
 $ rename 's/^---//g' *
 Unknown option: -vol.-01-disk-cantatas-bwv-3;
 Usage: rename [-v] [-n] [-f] perlexpr [filenames]

Use:
rename 's/^---//g' -- *

The -- is commonly used to let programs know that whatever follows should not be
interpreted as an option (which is necessary because your file name begins with 
--)

- Chris Burkhardt


-- 
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/hlpkgk$8l...@ger.gmane.org