POSIX awk CSV parser

csvawk is a less-than-correct but highly convenient POSIX-awk wrapper that enables awk to handle CSV input. Individual CSV fields are mapped to awk fields so that they may be accessed using the $ operator.

csvawk is a product of aggressive bodging; the goal was to produce a command-line utility that acts and accepts inputs the exact same way as awk does. Accomplishing this requires some form of complexity and compromise. Despite this, the main design goal has been fulfilled. And though some of its limitations may prevent it from being universal, it is more than suitable as a ad-hoc command-line solution.

csvawk is a personal response to the growing trend of writing brand new, bulky tools, each with their own set of options and quirks. Why install and learn an entirely new command-line utility when you could use a modified version of awk?

The source can be found here
The standalone, non-shebang version can be found here

Usage

Here's a quick, unprofessional sample scenario using output from the abhorrent nikto:
# csvawk '{ print $1 " sucks ass on port " $3 " because " $NF }' <<EOF
"moriendi.org","134.209.87.37","443","OSVDB-0","GET","/","The X-XSS-Protection header is not defined. This header can hint to the user agent to protect against some forms of XSS"
EOF

Produces:
moriendi.org sucks ass on port 443 because The X-XSS-Protection header is not defined. This header can hint to the user agent to protect against some forms of XSS

Limitations

csvawk does not accept any options other than -f, awk's error output is malformed (line numbers are incorrect), and there ought to be plenty of bugs (and bad design desicions). These limitations ought to be overcome sometime in the future, though I'm not particularily interested in resolving these.

csvawk cannot be included via -f into a regular awk command thanks to the shebang wizardry.

csvawk has not been tested extensively; reasonable edge cases have been considered, though faulty behaviour may still occur. Until a git repository is set up, bugs can be reported to mvk@moriendi.org

Neither speed nor efficiency were considered while writing this script.