Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I get output under the circumstances described in your edit:</p> <pre><code>$ echo "aaaproc1bbb" | grep -Eo 'proc1|proc2' proc1 $ echo $? 0 $ echo "aaabbb" | grep -Eo 'proc1|proc2' $ echo $? 1 </code></pre> <p>The exit code shows if there was no match.</p> <p>You might also find these options to <code>grep</code> useful (<code>-L</code> may be specific to GNU grep):</p> <pre> -c, --count Suppress normal output; instead print a count of matching lines for each input file. With the -v, --invert-match option (see below), count non-matching lines. (-c is specified by POSIX.) -L, --files-without-match Suppress normal output; instead print the name of each input file from which no output would normally have been printed. The scanning will stop on the first match. -l, --files-with-matches Suppress normal output; instead print the name of each input file from which output would normally have been printed. The scanning will stop on the first match. (-l is specified by POSIX.) -q, --quiet, --silent Quiet; do not write anything to standard output. Exit immediately with zero status if any match is found, even if an error was detected. Also see the -s or --no-messages option. (-q is specified by POSIX.) </pre> <p>Sorry for quoting the <code>man</code> page at you, but sometimes it helps to screen things a bit.</p> <p><strong>Edit</strong>:</p> <p>For a list of filenames that do not contain any of the procedures (case insensitive):</p> <pre><code>grep -EiL 'proc1|proc2' * </code></pre> <p>For a list of filenames that contain any of the procedures (case insensitive):</p> <pre><code>grep -Eil 'proc1|proc2' * </code></pre> <p>To list the files and show the match (case insensitive):</p> <pre><code>grep -Eio 'proc1|proc2' * </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload