The Linux (or unix) command awk is a powerful command line tool which opens up a whole world of possibilities on the command line and is specially suited to be part of a piped command.
The use of awk allows for many of the functionality thoughts you may have performed via a C command line program, but awk is an interpretive language tool, so it is very easy and quick to implement in your shell scripting work.
For today’s tutorial we set awk off to make the task of writing a report about the company takings a doddle. In two parts on the one command line (with sort) it manages to pare the data down to a simple useful report with the takings sorted by quantity and the cash register, which is implied by the record order of the CSV file, is also included via an awk operation.
As with all Linux command line commands man awk can help you find out more.
Some good background reading here would be:
- awk (Linux or unix awk command)
Here is a link to some downloadable Korn shell script you could call myawk.ksh
If this was interesting you may be interested in this too.