Do you wanna hear a joke?
Parsing XML with regexp
I did it too. But this was nightmareModern Linux Tools vs. Unix Classics: Which Would I Choose?
31–40 of 61 posts
Re: Modern Linux Tools vs. Unix Classics: Which Would I Choose?
#32I wonder if the script created by the author would go through edge cases of JSON, like escaped characters. I doubt and this sounds like a famous joke to me: Do you wanna hear a joke? Parsing XML with regexp I did it too. But this was nightmare
Re: Modern Linux Tools vs. Unix Classics: Which Would I Choose?
#33I too can never remember jq syntax when I need to. I usually just end up writing a Python script to extract the part of the JSON I need.
Same here! That's why for small things I made pyxargs [1] to use python in the shell. In another thread I also just learned of pyp [2] which I haven't tried yet but looks like it's even better for this use case.
Re: Modern Linux Tools vs. Unix Classics: Which Would I Choose?
#34Show the damn code. Otherwise I'm just going to presume that the awk&sed reimplemented Json parsing in an indecipherable, buggy way.
Re: Modern Linux Tools vs. Unix Classics: Which Would I Choose?
#35The title should read modern GNU tools. Linux is a kernel and supplies nothing useful for command line lovers. Nonetheless, the more modern tools are generally better, faster and more feature rich. I'd pick them over the older versions unless there was a compelling reason not to. Yes, I've used both. For almost forty years now.
Re: Modern Linux Tools vs. Unix Classics: Which Would I Choose?
#36Parsing JSON using 'cut' and 'awk' and 'sed' sounds like the jankiest thing ever. Sure, maybe you get it working, after much pain. Then someone decides to format your input JSON a bit differently, and everything fails catastrophically. This is the same problem described in the infamous answer "You can't parse [X]HTML with regex": https://stackoverflow.com/questions/1732348/regex-match-open... (Now, if you've been cau…
Re: Modern Linux Tools vs. Unix Classics: Which Would I Choose?
#37Earlier quoted context omitted.
If JQ is too much, see GRON &| Miller gron transforms JSON into discrete assignments to make it easier to grep for what you want https://github.com/tomnomnom/gron Miller is like awk, sed, cut, join, and sort for data formats such as CSV, TSV, JSON, JSON https://github.com/johnkerl/miller
Gron looks interesting, but I wish there was an option for bash output!
Re: Modern Linux Tools vs. Unix Classics: Which Would I Choose?
#38I too can never remember jq syntax when I need to. I usually just end up writing a Python script to extract the part of the JSON I need.
If JQ is too much, see GRON &| Miller gron transforms JSON into discrete assignments to make it easier to grep for what you want https://github.com/tomnomnom/gron Miller is like awk, sed, cut, join, and sort for data formats such as CSV, TSV, JSON, JSON https://github.com/johnkerl/miller
Re: Modern Linux Tools vs. Unix Classics: Which Would I Choose?
#39I too can never remember jq syntax when I need to. I usually just end up writing a Python script to extract the part of the JSON I need.
Re: Modern Linux Tools vs. Unix Classics: Which Would I Choose?
#40If I’m working on my own thing I’ll use a text based format.
Although recently I parsed json out with head, tail and sed. It was numeric data nicely formatted in lines so it was easier to just remove all the semantic structure than actually parse it.