10 ms·
I alway just use awk to process csv files. awk -F '^"|","|"$|,' '{print $2,$3}' whatever.csv The above works perfectly well, it handles quoted fields, or
by parasense 4y ago
I alway just use awk to process csv files.
awk -F '^"|","|"$|,' '{print $2,$3}' whatever.csv
The above works perfectly well, it handles quoted fields, or even just unquoted fields.... This snippet is taken from a presentation I give on AWK and BASH scripting.
That's the thing about AWK, it's already does everything. No need to extended it much at all.
- CRConrad 4y agoWhat about fields with "," in them?