这是一个示例输出curl -s ifconfig.me/all | column -t
:
ip_addr: 193.136.19.55
remote_host: gwec.di.uminho.pt
user_agent: curl/7.22.0 (x86_64-pc-linux-gnu) libcurl/7.22.0 OpenSSL/1.0.1 zlib/1.2.3.4 libidn/1.23 librtmp/2.3
port: 37429
lang:
connection:
keep_alive:
encoding:
mime: */*
charset:
via:
forwarded:
我喜欢以user_agent字段没有标签的方式解析它,并删除所有没有结果的字段。
ip_addr: 193.136.19.55
remote_host: gwec.di.uminho.pt
user_agent: curl/7.22.0 (x86_64-pc-linux-gnu) libcurl/7.22.0 OpenSSL/1.0.1 zlib/1.2.3.4 libidn/1.23 librtmp/2.3
port: 37429
mime: */*