Recently I wanted to audit some
Helm charts for trailing whitespace
bugs. This stuff can be a real bugbear, so an automated check can save a lot
of hair-tearing. I initially reached for the beloved awk
, but it turned out
that grep
could actually do exactly what I wanted.
Always read the manpage!
Diving deeper into AWK
I’ve always liked the Unix software toolbox concept: a variety of focused,
easily-understood, easily-composed tools that each do approximately one thing.
awk
is one of my favourites, so I
thought I’d write about how I most often apply it, and how you can get more
from it too.
In the following examples, I’ll use output from ps
, a useful source of test
data that is universally available on BSD, Linux and macOS systems. Things
should be mostly the same on other systems, too. If you’re using Solaris, for
example, there’s a BSD-like ps
in /usr/ucb/ps
.