- grep looks for the pattern's characters in a row anywhere in a line, including inside another word.
- Where a match sits is set by
^(start of line),$(end) and the-woption (whole word); square brackets are one character from a set. grep -Eunderstands|and+; the pattern'ERROR|Error:|err=[1-9]'finds every error in the log and nothing else.-oprints only the matches, and asort | uniq -cpipeline counts them.- At the start of the lesson,
grep errorfound the word terror and missed ERROR, Error: and err=5: the pattern was an exact substring and set neither the place of the match, nor case, nor variants.
Step 6 of 6 · summary · 2 min
Summary
Found an inaccuracy? Report an error in the lesson