On Sat, Oct 14, 2017 at 08:44:08AM +0000, Raul Miller wrote: > On Sat, Oct 14, 2017 at 3:08 AM, Andreas Kusalananda Kähäri > <andreas.kah...@icm.uu.se> wrote: > > find . -type f -mtime -1 \ > > -exec grep -q -E 'pattern1' {} ';' \ > > -exec shasum {} + > > That's cute, but it winds up spinning up a process for every file > (actually, in your example, two processes for every file). I generally > want to avoid doing that.
Only one, the grep, is run on each file. The shasum will be run on as many files as possible that passes the grep test. This is the way to do it without having to rely on the filenames produced by "grep -l" being parseable. Another thing to avoid is having too exotic filenames. -- Andreas Kusalananda Kähäri, National Bioinformatics Infrastructure Sweden (NBIS), Uppsala University, Sweden.