Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

If we're going for succinctness, you could combine these all together:

(echo '"Name","Credit Card"'; jq -r '.[] | select(.creditcard) | [.name, .creditcard] | @csv' data.json) >> `date +%Y%m%d`.csv



Nice trick to write the headers, thanks!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: