On Fri, Oct 13, 2017 at 11:52:11PM +0000, Raul Miller wrote:
> On Fri, Oct 13, 2017 at 7:37 PM, edgar <[email protected]> wrote:
> > Perhaps a real life example of what you have been doing with xargs before
> > and after your change would be helpful.
>
> That's tough, since when I was working on this issue I didn't have
> time to think about xargs and now that I have time to think about
> xargs the examples are distant memories.
>
> That said, something on the order of this:
>
> find . -type f -mtime -1 -print0 | xargs -0 egrep -l pattern1 | xargs shasum
find . -type f -mtime -1 \
-exec grep -q -E 'pattern1' {} ';' \
-exec shasum {} +
You almost never have to use xargs with find if you know how -exec
works.
Cheers,
>
> Anyways, I think I fixed it that time by removing all the files with
> problematic names, and another time by using a while loop instead of
> the second xargs, and a third time by writing a perl program, and the
> fourth time using grep -v ' ' in the pipeline, and probably a few
> dozen other hacks over the years...
>
> And if I search, I can find a tremendous variety of other elaborate
> approaches, including replacements for xargs. So it's not like this is
> not a real issue, nor is it like this isn't something that grows new
> handlings on an ongoing basis.
>
> What I'm trying to understand is why there's no simple fix. And maybe
> this really is just one of those things that will never get fixed.
>
> Thanks,
>
> --
> Raul
>
--
Andreas Kusalananda Kähäri,
National Bioinformatics Infrastructure Sweden (NBIS),
Uppsala University, Sweden.