Every story and comment from the Hacker News API, in a layout borrowed from 2001.
A comment on CSV Challenge.
jq -r '.[]|[.timestamp,.name,.creditcard]|@csv'<data.json|awk -F, '{if ($3!=""){f=substr($1,2,10)".csv";gsub(/-/,"",f);gsub(/"/,"",$0);c="(echo name,creditcard;cat -)>>"f;print $2","$3|c}}'
Strangely, the OP's "solution" actually omits the quotes around the strings, which adds unnecessary complexity.
There are no comments on this comment yet.
jq -r '.[]|[.timestamp,.name,.creditcard]|@csv'<data.json|awk -F, '{if ($3!=""){f=substr($1,2,10)".csv";gsub(/-/,"",f);gsub(/"/,"",$0);c="(echo name,creditcard;cat -)>>"f;print $2","$3|c}}'
Strangely, the OP's "solution" actually omits the quotes around the strings, which adds unnecessary complexity.