Posted By

afiedler8 on 03/03/10


csv awk

Versions (?)

Who likes this?

1 person have marked this snippet as a favorite


Filter a CSV file, eliminating some rows and columns

 / Published in: Bash

This filters a csv file, printing out the first, second, fifth, and seventh column only when the third column is "USD/JPY" and the fourth is "Q". Note this is awk, but there wasn't a selection for it.

  1. gawk -F, "{ if($3==\"USD/JPY\" && $4==\"Q\") printf \"%s %s,%s,%s
  2. \n\",$1,$2,$5,$7 }" data.csv

Report this snippet  

You need to login to post a comment.