Hacker News new | ask | show | jobs
by ColinWright 2457 days ago
For those complaining that they need it sorted by date:

    curl https://raw.githubusercontent.com/codelani/codelani/master/langs.csv \
        | awk -F "," '{print $NF, $0}' \
        | sort -n                      \
        | sed "s/^[^ ]* //"            \
        | less
This will fetch the CSV, copy the date to the front, sort it, then remove the date.

There are a lot of entries that don't have dates. If you want to remove them, pipe the result through:

    grep -v ",$"
4 comments

Just added column sorting by clicking the headers. But your solution is great too! Thanks!
`awk` is not needed since `sort` can apply to the fourth column.

    curl ... \
     | sort -t, -k4 -n
     | less
That's true, but the solution I suggested works to sort on the last column, whether or not there are exactly 4 columns. I avoided having to count how many columns there are, assuming only that the date comes last.

But yes, if you know the date is in the 4th column then your solution also works.

Anyone around to convert this to that nushell that was featured on HN a few weeks ago? I'm curious to see what the comparison would look like in a super practical real-life scenario
Thank you!