Live data from Hacker News

Modern Linux Tools vs. Unix Classics: Which Would I Choose?

meetryanflowers.com

21–30 of 61 posts

Re: Modern Linux Tools vs. Unix Classics: Which Would I Choose?

#22
post #11

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

Okay, who let rms in here?

Re: Modern Linux Tools vs. Unix Classics: Which Would I Choose?

#23
post #20

jq is definitely tough to learn, I can never remember it. But, the whole argument against jq as a unitasker not worth learning and traditional unix tools being better is weird. Traditionally Unix tool mentality was “do one thing only and do it well” then pipe it together. jq fits perfectly into the Unix toolset.

Yes jq is definitely a tool like that. The problem nowadays is maybe more that there are many competing options. jq seems most popular for JSON parsing but once in a while another tool is used that maybe has better ergonomics but a different syntax etc. You can master jq but it will not be enough since there is no consensus. This used to be easier I believe, the tools in common use were fewer. So let's imagine awk got JSON support. Would that be for the better or worse?

Re: Modern Linux Tools vs. Unix Classics: Which Would I Choose?

#25
post #10
post #4

I 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

Gron looks interesting, but I wish there was an option for bash output!

Re: Modern Linux Tools vs. Unix Classics: Which Would I Choose?

#26
post #3

Parsing 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…

JSON is a particularly bad example, given that most of the commonly used scripting languages have standard libraries to parse JSON into a native data structure.

Re: Modern Linux Tools vs. Unix Classics: Which Would I Choose?

#28

awk, sed etc. belong to the museum, now that we have so many tools and libraries that can handle structured data. The whole early Unix obsession with plain text files was a step in the wrong direction. One grating holdover of that is the /proc filesystem. Instead of a typed, structured api you get the stuff as text to be parsed, file system trees and data embedded in naming conventions.

I unironically disagree with this, structured data is incredible and powerful.

But an important part of the early internet was "its Just Text".

And in fact, the reason why JSON is so great is that if you want to use it as Just Text it works just the same!

It's a translation layer between systems that really demand highly structured data and flexible systems where as long as you can thunk about it, you can get from anywhere to anywhere else with a few simple programs that are on every machine in tbe known universe.

Re: Modern Linux Tools vs. Unix Classics: Which Would I Choose?

#29
post #4

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

I tend to frustrate colleagues with this but it's honestly so much more manageable.

A python script is the sane extensible choice rather than some esoteric bash incantation that you have no clue about 6 months after writing it.

Re: Modern Linux Tools vs. Unix Classics: Which Would I Choose?

#30
i think more linux distros should adopt powershell, its really good, and i think solve this new tools , old tools issue better

i think with pwsh you wont need to use bash when you can and python when you have to, you just use pwsh, it bridge the gap between shell and programming better than ... a polyglot bash + python combo

Post reply on HN