Parsing data from ifconfig with awk or sed?

前端 未结 3 1841
悲&欢浪女
悲&欢浪女 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 07:04

    use grep:

    ifconfig | grep -oP '(?<=RX bytes:)[0-9]*'
    

    use awk:

    ifconfig | awk -F: '/RX bytes/{print $2+0}'
    

提交回复
热议问题