>_ IzzyLab

Topic breakdown

grep selects lines by a pattern, and the -c flag prints how many there are instead of the lines themselves — the shortest way to count events in a log. The catch is pattern precision: a short sequence of digits easily appears in several fields of a line — in the response code, in the size, in the page address. To count only the field you need, the pattern must include its boundaries: the surrounding spaces, the quote before it, or the end-of-line anchor.

What's checked

  1. /root/notfound.txt created
  2. number of 404 responses counted correctly

What it looks like