3 ms·
I wanted to ask why not the more simple form: echo '"foo","bar,baz","boo"' | awk -F"\",\"" '{print $1}' "foo echo '"foo","bar,baz","boo"' | awk -F"\",\"" '{pr
by poetaster 3y ago
I wanted to ask why not the more simple form:
echo '"foo","bar,baz","boo"' | awk -F"\",\"" '{print $1}'
"foo
echo '"foo","bar,baz","boo"' | awk -F"\",\"" '{print $2}'
bar,baz
echo '"foo","bar,baz","boo"' | awk -F"\",\"" '{print $3}'
boo"
Realizing that I have to strip the quotes that remain.
Edit. formatting.
EDit, again, from your link, the following is more terse and too my taste (still needs strips):
awk -v FPAT='("[^"]*")+'