Re: rename command (original) (raw)


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


From: Sami Kerola
Subject: Re: rename command
Date: Tue, 28 Jun 2011 12:21:03 +0200

On Tue, Jun 28, 2011 at 11:48, Erik Auerswald <address@hidden> wrote:

On Tue, Jun 28, 2011 at 09:57:02AM +0100, Pádraig Brady wrote: > On 28/06/11 08:21, Erik Auerswald wrote: > > On Mon, Jun 27, 2011 at 05:26:48PM +0100, Pádraig Brady wrote: > >> On 27/06/11 10:11, Sami Kerola wrote: > >>> > >>> I have been lately making some util-linux patches and while doing > >>> so I found rename command. > >>> [...] > >> > >> I've never used rename actually, instead using find | sed | sh > >> in the rare times I've had to do something like this. > >> I find that easier and more general, for lower casing etc. > >> That is a process per file though. > > > > FWIW, I usually use the rename perl script as distributed by Debian with > > the perl package (because it is available, convenient and works well). > > Good point. > > # dpkg -S (readlink−f(readlink -f (readlinkf(which rename)) > perl: /usr/bin/prename > > That one supports -f for "force" too, > but -n means "test" rather than "noclobber". > > Of course the replacement syntax is different > and is more like my find | sed | sh pattern above, > except it's not a process per file. > So I'd prefer this one TBH. > > So portable scripts should use prename I guess > for the perl syntax, and rename for the util-linux one.

I don't think this is really portable, the 'p' prefix was added to fix Debian bug #304705. In fact I don't know if, where and under which name this rename Perl script can be found in other distris or even the BSDs.

BSD has a bit more advanced rename.

http://rename.berlios.de/

I guess that is not much in use because the only version of on line manual page I found was in Google cache.

http://webcache.googleusercontent.com/search?q=cache:y1_wk6tYjCwJ:https://1command.com/man/index.cgi

The syntax seems to be a little bit different, which is something to mind if a coreutils version aims to be general replacement of all of them. So far the test option is only one which seems to vary.

--    Sami Kerola    http://www.iki.fi/kerolasa/