Hello everyone! I have awesome news – I just wrote my first e-book ever. It's called Awk One-Liners Explained and it's based on the Awk One-Liners Explained article series that I wrote here on my blog a few years ago and that has been read over 2,000,000 times.
I went through all the one-liners in the article series, improved the explanations, fixed the mistakes, added an introduction chapter to Awk one-liners, and two new chapters on the most commonly used Awk special variables and on idiomatic Awk.
Awk is this awesome, little program that's present on nearly ever Unix machine. It's designed to carry out various text processing tasks easily, such as numbering lines, replacing certain words, deleting and printing certain lines.
That's all there is to it. Awk automatically splits each line into columns and puts each column in variables $1, $2, $3, etc. This one-liner prints just the 2nd column, which is in variable $2.
You can also specify the symbol or word that you want to split on with the -F command line switch. This switch is explained in more details in the e-book and in the last example below.