>_ IzzyLab

Topic breakdown

Cleaning trailing whitespace from text is a classic sed substitution with the s/pattern/replacement/ command, where the right side is an empty string (deletion). The point is to describe "whitespace characters pressed against the end of the line": for the set of whitespace characters POSIX classes are convenient (they cover both tabs and ordinary spaces, unlike a literal [ ]), and the binding to the end is expressed with the $ anchor. Without the anchor the substitution risks touching spaces in the middle of the line, so it's precisely the anchor that makes the operation safe.

What's checked

  1. no trailing spaces or tabs
  2. content preserved

What it looks like