nburger
Joined 16 years ago
Karma
94
Submissions
19
Member since
Jun 16
Joined 16 years ago
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.
(echo '"Name","Credit Card"'; jq -r '.[] | select(.creditcard) | [.name, .creditcard] | @csv' data.json) >> `date +%Y%m%d`.csv
"Wherever Senturion is housed it probably looks a lot like this, but more ominous and with blinkier lights."
That this statement is less than rigorous doesn't speak well for the remainder of the article.