Hacker News new | ask | show | jobs
by andrvo 3062 days ago
While jq is definitely faster, for more complex tasks I love using ramda-cli [1]. It has all the functions from the excellent Ramda [2] AND you can use LiveScript's [3] terser syntax (and pipes!).

Here's a quick command to output a list of recent files on Linux:

    xml2json < ~/.local/share/recently-used.xbel | ramda '.xbel.bookmark |> pluck \href |> map replace /file:\/\//, ""' -o raw
1. https://github.com/raine/ramda-cli 2. http://ramdajs.com/ 3. http://livescript.net/
1 comments

And here's a more interesting example using output from Algolia's search API:

   curl 'https://<redacted Algolia url>' | ramda '.hits |> map pick <[title url story_url objectID points num_comments]> |> evolve title: take 2 |> sort (.points) |> reverse'