Hacker News new | ask | show | jobs
by tehalex 2237 days ago
Here's the ruby equivalent:

https://github.com/thisredone/rb

2 comments

Was hoping to find a comment just like yours! Thanks!

I use Ruby from the cli frequently for stuff that exceeds an easy jq expression or if jq is not availabel but Ruby is (which happens a lot on RHEL systems when EPEL is not enabled, which is the case in a lot of banks) Ruby's awk -> perl -> ruby heritage endows it with a pretty good cli mode, but sometimes it's verbose. For example parsing json:

    curl https://something \
      | ruby -r json -e "puts JSON.parse(STDIN.read)['data']['ip']"
But obviously that's wordier than it needs. (To pre-empt the "just use jq!" people, I agree. For simple examples I would just use jq. This example here is just an example).
Awesome! Thanks!