HN user

nburger

94 karma
Posts4
Comments14
View on HN
CSV Challenge 11 years ago

Here's a solution using just one instance of jq+awk that handles the "multiple files" scenario and writes proper headers on each:

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.

CSV Challenge 11 years ago

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

AWS Storage Gateway 15 years ago

Note that the $125 "gateway" fee is minor compared with the storage/transfer fees themselves - $0.14/GB/month for storage, for example. At that rate, a small 5 TB volume is already $700/month.

I stopped reading after glancing at the caption underneath the article's image:

"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.

Python/Java/Flash - Atlanta, GA Turner Broadcasting System

We're looking for both entry-level and experienced developers to help in building out existing video frameworks (playback, transcoding, streaming, etc.) that support several large Internet properties. Contact info is in about.

Ahh.. you're right, of course. What I wrote has an undefined termination condition, besides not being consistent with the original algo. Thanks.

And you could save an additional character by changing the loop test to a+b form, i.e.:

int i,x[99];for(x[98]=i=1;x+98;)i*=!++x[i++];

The other array references are l-values.