3 ms·
> there is no way to represent key-value pairs or nested data and then do things like extract fields or filter on values man, ever heard of awk? It was design
by enriquto 2y ago
> there is no way to represent key-value pairs or nested data and then do things like extract fields or filter on values
man, ever heard of awk? It was designed exactly for that purpose.
- throw10920 2y agoI'm very well aware of awk. This proves my point - Unix doesn't have a way to represent structure, so the only way that you can manipulate it is with purpose-built tools. There's no way to tell "sort" to sort on a specific field, for instance - sort does not understand structure. Things that are trivial in a structured/typed language like PowerShell or Python require a lot of sed/awk glue in Unix and are far less reliable as a result. Anyone who has a basic understanding of computing theory understands that shell is obviously Turing-complete and can compute anything that another Turing machine has - which means that being able to hack something together does not mean that the system was designed for that paradigm. You can implement Prolog in C, but that does not mean that C is a declarative logic programming language, and if you find yourself repeatedly re-implementing Prologs in your C programs, you'd do very well to have the self-awareness to realize that C is probably not the right choice for the problems you're trying to solve. Similarly, if you have to repeatedly shell out to a tool that understands structure like awk or Perl or jq, you'd do well to consider as to whether the shell doesn't actually fit the problem you're trying to solve. There's a reason why there are precisely zero large pieces of software written in bash - because it's an extremely poor paradigm for computation.