grep line selection
grep searches input for a pattern and emits matching lines. Plain patterns use regular-expression rules, so punctuation such as a dot can match more than its literal character. Use grep -F when searching for exact text, and grep -n when line numbers help investigation. A status of zero means a match was found, one means no match, and a higher status indicates an error. This difference matters in scripts: an empty result is not necessarily a broken tool. Prefer anchored or field-aware patterns when a loose match could select an unrelated status or identifier.
grep -n " 500 " access.log selects the failure line with its line number.
Precise selection narrows large evidence sets and avoids mistaking a coincidental substring for the status, host or identifier you actually intended to inspect.
Using grep 500 can match a byte count or path containing 500; anchor the relevant structure or use awk for field-aware selection.