Awk
From charlesreid1
Awk is a really powerful data-driven programming language.
Basics
The basic syntax of an awk program is:
awk 'condition { statement }'
Parsing
You can parse a list using awk by using the -F flag, followed by the delimiter (by default, it is space). Each token can then be referred to using $1, $2, $3, etc.
$ echo "token1.token2.token3"
token1.token2.token3
$ echo "token1.token2.token3" | awk -F. '{print $1}'
token1
$ echo "token1.token2.token3" | awk -F. '{print $2}'
token2
This can be done with any character, not just punctuation:
$ echo "token1atoken2atoken3"
token1atoken2atoken3
$ echo "token1atoken2atoken3" | awk -Fa '{print $1}'
token1
$ echo "token1atoken2atoken3" | awk -Fa '{print $2}'
token2