While I get what they mean by "tabular JSON", that's a bit of a misnomer.
Miller: Like Awk, sed, cut, join, and sort for CSV, TSV, and tabular JSON
31–40 of 109 posts
Re: Miller: Like Awk, sed, cut, join, and sort for CSV, TSV, and tabular JSON
#32Earlier quoted context omitted.
The whole point of UNIX userland is to not have to write a custom program for every simple case that just needs recombining some existing basic programs in a pipeline...
> simple case that's just it though, the last example is not a simple case, hence why the last example is awkward by the commenters own admission. command line tools are fine, but you need to know when to set the hammer down and pick up the chainsaw.
tail -n +2 example.csv | sort -r -k4 -t','
Or more often, I just do this and ignore the header sort -r -k4 -t',' example.csv
Keeping the header feels awkward, but using `sort` to reverse sort by a specific column is still quicker to type and execute (for me) than writing a program.Re: Miller: Like Awk, sed, cut, join, and sort for CSV, TSV, and tabular JSON
#33Even without aliases, I still prefer PowerShell on Windows. Once you've turned the text into an object, you can pipeline it to hell. Get-Content .\example.csv | ConvertFrom-Csv | Where-Object -Property color -eq red
Re: Miller: Like Awk, sed, cut, join, and sort for CSV, TSV, and tabular JSON
#34Great tool. BUT, leaks memory like crazy. Despite documentation stating the verbs are fully streaming. > Fully streaming verbs > These don't retain any state from one record to the next. They are memory-friendly, and they don't wait for end of input to produce their output. https://miller.readthedocs.io/en/6.7.0/streaming-and-memory/...
> BUT, leaks memory like crazy. Huh? a) Isn't it written in Golang, which has a GC? Does it do custom buffer based management? b) Isn't it supposed to be run on a file and get some output - as opposed to an interactice session? Why would it matter if it leaks, then, and how could it leak, as the memory is returned to the OS when it ends?
Some gains were made on https://github.com/johnkerl/miller/pull/1133 and https://github.com/johnkerl/miller/pull/1132
Re: Miller: Like Awk, sed, cut, join, and sort for CSV, TSV, and tabular JSON
#35Earlier quoted context omitted.
> BUT, leaks memory like crazy. Huh? a) Isn't it written in Golang, which has a GC? Does it do custom buffer based management? b) Isn't it supposed to be run on a file and get some output - as opposed to an interactice session? Why would it matter if it leaks, then, and how could it leak, as the memory is returned to the OS when it ends?
It's indeed written in Go now, which indeed has GC, and ultimately all memory is freed ... but there are indeed some issues around intermediate retention of memory, taking more memory than one would have expected. Some gains were made on https://github.com/johnkerl/miller/pull/1133 and https://github.com/johnkerl/miller/pull/1132
Re: Miller: Like Awk, sed, cut, join, and sort for CSV, TSV, and tabular JSON
#36How is it better that SQL for these tasks on tabular data? That's the first question I have after reading the title. Haven't read the article. Edited the first sentence. Originally it was "Why it is not called SQL if works on tabular data?". My point, if one wants cat, sort, sed, join on tabular data, SOL is exactly that. Awk is too powerful, not sure about it.
> How is it better that SQL for these tasks on tabular data? It has far better handling of a CSV/TSV file on the command line directly and is compasable in shell pipelines. > My point, if one wants cat, sort, sed, join on tabular data, SOL is exactly that. SQL is a language for data in the form of tables in relational databases. While it can do sorting or joining or some changes, it is meant for a different domain th…
Doesn't need to load anything to DB
Can be used in shell
Can read from stdin and write to stdout
Re: Miller: Like Awk, sed, cut, join, and sort for CSV, TSV, and tabular JSON
#37Re: Miller: Like Awk, sed, cut, join, and sort for CSV, TSV, and tabular JSON
#38Re: Miller: Like Awk, sed, cut, join, and sort for CSV, TSV, and tabular JSON
#39Re: Miller: Like Awk, sed, cut, join, and sort for CSV, TSV, and tabular JSON
#40Discussion of a similar tool last month: yq: command-line YAML, JSON, XML, CSV and properties processor https://news.ycombinator.com/item?id=34656022 Also mentions gojq, Benthos, xsv, Damsel, a 2nd yq, htmlq, cfn-flip, csvq, zq, and zsv.