Hacker News new | past | comments | ask | show | jobs | submit | nburger's comments login

The tail number is a prime number (in reference to Prime customers) and is also the year AMZN went public.


I totally missed that. Good eye!


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.


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!


Have you taken a look at BookVibe? [ http://www.bookvibe.com/ ]


Congratulations on the launch! Also an Atlanta native and signed up!


Thanks! Spread the startup news!


Good stuff. Take a look at Fabric for another (and very commonly-used) example of Python wrapping SSH: http://docs.fabfile.org. Also you might look to Paramiko for a native SSH implementation: https://github.com/paramiko/paramiko.


Hi Nburger,

Thanks.

Yeah, Fabric is awesome. Really like it. Have not looked that much at Paramiko tho.


or "sort -R"...


sort -R isn't actually a random permutation or shuffle like one would ordinarily expect from a 'random' output: if you read the man page very carefully, you'll notice it only speaks of 'random hash' which means that 2 lines which are identical (quite possible and common) will be hashed to the same value and placed consecutively in the output.

(This bit me once. Filed a bug about maybe clarifying the man page, but nope, apparently we're all supposed to recognize instantly the implication of a random hash.)


Good luck -- looks interesting. "Documentary" misspelled, fwiw.


thx!


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.


The remainder of the article is equally tongue-in-cheek.


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

Search: