Skip to content

Instantly share code, notes, and snippets.

@chencang
chencang / parse_csv_demo.sh
Created March 21, 2019 09:36 — forked from huandu/parse_csv_demo.sh
Demo to parse CSV file with awk.
# parse csv files to an awk array.
awk -F, '{
parse_csv(r);
# replace following line with your code.
print r[1], r[2], r[3], r[4];
} function parse_csv(r, _quote, _i, _n) {
_i = 1;
_quote = 0; # in a quoted string or not.