Lucas Gomez
Lucas Gomez

Reputation: 145

AWK command print number only

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

Answers (1)

Gilles Quénot
Gilles Quénot

Reputation: 185550

Like this, using a proper parser: :

curl -s 'https://bch-chain.api.btc.com/v3/block/latest' | jq '.data.height'

 output

613777

Upvotes: 2

Related Questions