Live data from Hacker News

Parsing JSON in Forty Lines of Awk

akr.am

61–62 of 62 posts

Re: Parsing JSON in Forty Lines of Awk

#61
post #33

Earlier quoted context omitted.

Same with Python. It's mostly available, but sometimes not. With Perl, I find that a base installation is almost always available, but many packages might not be.

I dunno about that. IME, python is much, much more universally installed on the hosts I've worked on. Sure, usually it's 2.7, but it's there! I've tended to work on rhel and debian hosts, with some fedora in the mix. (Once had a coworker reject a PR I wrote because I included a bash builtin in a deployment script. He said that python is more likely to be installed than bash, so we should not use bash. These debates a…

Interesting, in my experience perl ends up pulled in as a dependency for one thing or another most of the time, but I don't have that perception about Python. Maybe there's just something I use that pulls in perl without me realizing and it's biased my experience.

Re: Parsing JSON in Forty Lines of Awk

#62
post #14
post #9

Earlier quoted context omitted.

>awk really shoots itself so much with its lack of features that it so desperately needs! That's why I use Perl instead (besides some short one liners in awk, which in some cases are even shorter than the Perl version) and do my JSON parsing in Perl. This diff -rs a/ b/ | ask '/identical/ {print $4}' | xargs rm is one of my often used awk one liners. Unless some filenames contain e.g. whitespace, then it's Perl again

This is much safer: xargs -d '\n' rm -f --

Just tried to use "-d" and learned that it's a GNUism which isn't available under MacOS, so it's not a portable solution. And neither was it available under BSD 4.3 when I learned about xargs the first time.
Post reply on HN