Modern Linux Tools vs. Unix Classics: Which Would I Choose?
21–30 of 61 posts
Re: Modern Linux Tools vs. Unix Classics: Which Would I Choose?
#22The 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?
#23jq 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.
Re: Modern Linux Tools vs. Unix Classics: Which Would I Choose?
#24Re: Modern Linux Tools vs. Unix Classics: Which Would I Choose?
#25I 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?
#26Parsing 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?
#27They had a simple problem, they used simple tools they were familiar with. That doesn't make other solutions worse, or their solution better, it just means the problem was simple enough that it barely mattered one way or another.
Re: Modern Linux Tools vs. Unix Classics: Which Would I Choose?
#28awk, 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.
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?
#29I 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.
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?
#30i 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