Build Status

CSVAWK

This simply passes a CSV file to AWK with a Perl wrapper. It lets you:

Output specific fields:

csvawk '{ print $foo, $bar }' file.csv

Output the header and records matching a specific condition:

csvawk 'NR==1 || $foo=="bar" { print }' file.csv

Edit a single field and output:

csvawk 'NR>1 { $foo="bar" } { print }' file.csv

Count records matching certain conditions:

csvawk '$foo=="bar" { ++count } END { print count }' file.csv

Pretty print your program in gawk and inspect it:

csvawk -g '{ print $foo }' file.csv -- --pretty-print
less awkprof.out

List headers, one per line:

csvawk 'NR == 1 { for (i = 1; i <= NF; i++) print $i }' file.csv