Here are a few quick and dirty I use for handling output of MySQL. (For serious stuff I include real CSV libraries in the one liner to quote correctly etc.)
alias sqlcmdtocsv="perl -nE 'chomp; s/\\t/;/g; say \$_;'"
alias sqlcmdtoperl="perl -MData::Dump=dump -nE 'chomp; @r=split(/\\t/); if (@titles == 0) { @titles=@r; next; } \$row={}; for(\$i=0; \$i < @r; \$i++) { \$row->{\$titles[\$i]} = \$r[\$i]; } push @rows, \$row; END { say dump \\@rows };'"
# Quick and dirty for moving from the real DB to the test DB.
# Use: mysql_generates_a_row | sqlcmdtoperl | dumptosqlinsert
alias dumptosqlinsert="perl -E 'my \$txt; { local \$/; \$txt=<>; } my \$rows= eval \$txt; \$q=chr(39); for my \$r (@\$rows) { @cols=map { \$v=\$r->{\$_}; if (\$v eq \"NULL\") {\"\$_=NULL\"} else {\"\$_=\${q}\$v\$q\"} } keys %\$r; say join(\", \", @cols);}'"
I have a bunch of aliases for conversions, to generate common SQL that dependend on parameters and so on.