Live data from Hacker News

Miller is like sed, awk, cut, join, and sort for name-indexed data such as CSV

johnkerl.org

21–30 of 81 posts

Re: Miller is like sed, awk, cut, join, and sort for name-indexed data such as CSV

#27

Nothing wrong with this approach I suppose but wouldn't most people be better off to just use a database for this sort of thing?

Depends on your familiarity with the unix toolset vs use cases, an amusing (if somewhat contrived) example of this:

http://aadrake.com/command-line-tools-can-be-235x-faster-tha...

Most CSV analysis is static, not something ongoing with inserts/updates/etc, so using a combination of unix tools to handle the data processing seems like a sufficient solution for many scenarios.

Re: Miller is like sed, awk, cut, join, and sort for name-indexed data such as CSV

#28

Nothing wrong with this approach I suppose but wouldn't most people be better off to just use a database for this sort of thing?

I use CSV all the time because I am constantly generating new datasets and it is nice to be able to literally cat|pbcopy them and paste them into DataGraph to see the results. Every major language has some sort of csv reader (usually into a dataframe type object) which makes it very easy to work with. Databases in my experience are laborious to set up and I would need to learn the API rather than just println("a,b,c,d").

Re: Miller is like sed, awk, cut, join, and sort for name-indexed data such as CSV

#30
post #19

Can anyone suggest something similar for Windows?

PowerShell can handle CSV files natively.

Here are the equivalent commands from the article:

  Import-Csv example.csv | Select-Object year, price   | Export-Csv -NoTypeInformation example-cut.csv
  Import-Csv example.csv | Sort-Object   year          | Export-Csv -NoTypeInformation example-sorted.csv
  Import-Csv example.csv | Where-Object  year -eq 1999 | Export-Csv -NoTypeInformation example-filtered.csv
PowerShell can also deal with JSON and XML in much the same way.
Post reply on HN