AWK (COMP2041)

AWK is an amazing magical tool that will make your life better.

"The AWK utility is a data extraction and reporting tool that uses a data-driven scripting language consisting of a set of actions to be taken against textual data (either in files or data streams) for the purpose of producing formatted reports. The language used by awk extensively uses the string datatype, associative arrays (that is, arrays indexed by key strings), and regular expressions."

Input format:

awk '{command $xF}' where x is a field number (N being last)

You can use it for things like:

awk '{print $1F}' = prints the first field
awk '{print length " " $0F}' = prints the length of each line before the line