Reputation: 145
I am trying to print just the number with this code, although I get the "XXX,version". Any ideas how I could fix it?
wget -O - https://bch-chain.api.btc.com/v3/block/latest 2>/dev/null | awk -F ':' '{print $3}'
613777,"version"
Any help is greatly appreciated.
Upvotes: 1
Views: 63
Reputation: 185550
Like this, using a proper json parser: jq :
curl -s 'https://bch-chain.api.btc.com/v3/block/latest' | jq '.data.height'
613777
Upvotes: 2