[Top][All Lists]

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

Re: Support for inline input

From: Bernhard Voelker
Subject: Re: Support for inline input
Date: Fri, 13 Oct 2017 01:08:10 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0

On 10/12/2017 10:16 PM, Kristian Benoit wrote:
> It took me time trying to remove './' at the beginning of each line of
> output. The problem is that I tried with '-exec'. I got it working
> this way:
> find . -maxdepth 1 -type d | sed -e 's/^\.\///'

You already showed the standard way to strip off the leading 2 characters;
another one is e.g.
  $ find . -printf '%P\n'
But still: what exactly is the problem with output starting with "./"?
I mean you explicitly asked 'find' to search for directories in ".",
so the output is exactly that.
(You could also have launched "find * ..." to avoid it.)

> I don't know why I didn't thought of using a pipe, but it could be
> nice to have the output piped to the exec function, lets say with
> pexec.
> find . -maxdepth 1 -type d -pexec sed -e 's/^\.\///' \;
> This way the param to pexec could handle only one line, not the whole
> output at once. I'm saying this because it could be nice to enhance
> cooperation between GNU tools.

Hmm, at first glance this one maybe interesting ... to avoid the explicit
pipe for commands which accept file names on stdin, but OTOH one could
then request this for almost any tool out there which outputs file names
like stat, grep, and many, many other tools out there.  The already
existing way is to let the shell do the work with "CMD1 | CMD2", and
I'd consider this sufficient - especially in the context of post-processing
file names for which %P already works.

Have a nice day,

reply via email to

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