public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
From: Mark David Dumlao <madumlao@gmail.com>
To: gentoo-user@lists.gentoo.org
Subject: Re: [gentoo-user] look for a file type + sort
Date: Sat, 14 Sep 2013 12:04:02 +0800	[thread overview]
Message-ID: <CAG2nJkO0qTWPC4t9G-t+90AjqicsKrMmcMsyQDk-o06pt=XmaQ@mail.gmail.com> (raw)
In-Reply-To: <52331848.8030603@yandex.ru>

[-- Attachment #1: Type: text/plain, Size: 1507 bytes --]

On Sep 13, 2013 9:53 PM, "Yuri K. Shatroff" <yks-uno@yandex.ru> wrote:
>
> On 13.09.2013 17:43, Mark David Dumlao wrote:
>>
>> On Fri, Sep 13, 2013 at 9:36 PM, Yuri K. Shatroff <yks-uno@yandex.ru>
wrote:
>>>
>>> On 13.09.2013 10:24, Jean-Christophe Bach wrote:
>>> [ ... ]
>>>
>>>>
>>>> This one should work:
>>>>
>>>> find /home/joseph/ -iname "*.pdf" -exec ls -l --sort=time {} +
>>>
>>>
>>>
>>> -exec is not suitable here because it spawns a `ls` process per each
found
>>> entry; aside from being slow, this disallows sorting at all.
>>
>>
>> This is incorrect. If you terminate exec with '+' instead of '\;', only
a single
>> instance of the command is run - the command line is built by appending
>> each found file to the end of the {} placeholder.
>
>
> Sorry, I'm ashamed
> I didn't know about this feature. Does it also handle spaces correctly?
>

I'm not sure how the internals work. As best as I can guess, it constructs
the argv directly so spaces shouldn't be an issue. Spaces are an issue when
the output is piped through, since the pipe itself knows no difference
between filename and output spaces, hence the need to force zero delimiters
between filenames. Since find runs the command directly, you shouldn't
encounter this. But Ive yet to test.

>
>> The only reason I see for it to fail is if you have so many files that
>> it can't be
>> passed to the argv of the receiving command.
>
>
> There's always an opportunity to use tempfiles ;)
>
>
>
> --
> Best wishes,
> Yuri K. Shatroff
>

[-- Attachment #2: Type: text/html, Size: 2141 bytes --]

  reply	other threads:[~2013-09-14  4:04 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-13  4:48 [gentoo-user] look for a file type + sort Joseph
2013-09-13  4:58 ` Canek Peláez Valdés
2013-09-13  5:04   ` Canek Peláez Valdés
2013-09-13  5:11     ` Joseph
2013-09-13  5:16       ` Canek Peláez Valdés
2013-09-13  6:24         ` Jean-Christophe Bach
2013-09-13  6:50           ` Florian Philipp
2013-09-13 12:45             ` Joseph
2013-09-13 13:36           ` Yuri K. Shatroff
2013-09-13 13:43             ` Mark David Dumlao
2013-09-13 13:51               ` Yuri K. Shatroff
2013-09-14  4:04                 ` Mark David Dumlao [this message]
2013-09-14 19:16                   ` Florian Philipp
2013-09-13 20:52 ` Alexander Kapshuk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAG2nJkO0qTWPC4t9G-t+90AjqicsKrMmcMsyQDk-o06pt=XmaQ@mail.gmail.com' \
    --to=madumlao@gmail.com \
    --cc=gentoo-user@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox