3 ms·
Here's the ruby equivalent: https://github.com/thisredone/rb https://github.com/thisredone/rb
by tehalex 6y ago
Here's the ruby equivalent:
https://github.com/thisredone/rb https://github.com/thisredone/rb
- eloahx 6y agoAwesome! Thanks!
- freedomben 6y agoWas 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).