coreutils
[Top][All Lists]
Advanced

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

Re: rename command


From: Sami Kerola
Subject: Re: rename command
Date: Sun, 3 Jul 2011 00:13:52 +0200

On Sat, Jul 2, 2011 at 17:56, Sami Kerola <address@hidden> wrote:
[snip]
> o Add upper & lower casing options, which needs to obey locale.
[snip]
> o Add --sed to do complicated name manipulations (only an idea).
> Assuming this is desired should I simply copy all necessary code from
> sed to be a coreutils/src/sed_functions.c? Perhaps sed style string
> manipulations should be part of gnulib. Perhaps something other,
> better and maintainer acceptable?

The more I think about these two the worse they feel. Problem is that
there is no end what converters people might want to use. Someone will
need rename to md5sums, another wants rot13 and of course someone has
a use case to bzip2 uuencoded names. My point is that
--lower/uppercase & --sed options are special cases and they must go.
Option --exec is needed instead.

To keep things simple the exec needs to support reading from stdin and
write stdout only the string which will be used as rename destination.
It might be wise do rename only if exec return successfully. The three
converters I had in mind would in thes case be

--exec='dd conv=lcase 2>/dev/null'
--exec='dd conv=ucase 2>/dev/null'
--exec='sed \'s/regex/replacement/\''

Which would also enable people to write how ever complicated
converters they prefer. Assuming this is better approach there is
still unanswered questions. What to do with --test functionality?

p.s. The util-linux rename syntax will have to be a special case
conversion, but it will be the only one.

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]