Parsing data from ifconfig with awk or sed?

前端 未结 3 1832
悲&欢浪女
悲&欢浪女 2021-01-07 06:18

I am trying to parse some data from ifconfig output with sed, but I am not able to do it correctly. I want the command to extract just the number I am after.

For exa

3条回答
  •  温柔的废话
    2021-01-07 06:49

    IMHO there is no standard for the ifconfig - output. It (may) change from system to system and from release to release.

    If I were you, I would go for the /sys file system. You get all the information also from there - without the need of post-processing.

    $ cat /sys/class/net/eth0/statistics/rx_bytes
    37016050
    

提交回复
热议问题