Today I decided to add csv-grep to App::CSVUtils, as an alternative to NEILB's csvgrep (which Neil announced about a week ago). I find csvgrep too simplistic for my taste or future needs. It's basically equivalent to:

% ( head -n1 FILE.CSV; grep PATTERN FILE.CSV ) | csv2asciitable



find

ls

I also think csvgrep'soption does not belong. It's not relevant to grepping as well as too case-specific. What if user wants the oldest file in the directory? The biggest? Theorcommand should be able to do that for you:

% csvgrep PATTERN "`ls *.csv –sort=t | head -n1`"



In csv-grep, you specify Perl code instead of regex pattern. Your Perl code receives the CSV row in $_ as an arrayref (or hashref, if you specify). So you can filter based on some particular fields and use the full expressive Power of Perl. csv-grep outputs CSV, but you can convert it to other formats by the abovementioned csv2asciitable , or to JSON with csv2json , or to Perl data structure with csv2dd , or what have you.

Aside from csv-grep, App::CSVUtils also includes a bunch of other CSV utilities which I wrote when I needed to munge CSV files a few months back. Check it out.