SED command


New Member

I was hoping that someone could point me in the right direction as I am going around in circles. I want to extract the RX packet count value from ifconfig for the NIC called eth0.

The best I have is - ifconfig eth0 | sed -e 's/RX packets \(.*\)bytes/\1/'

The RX packet count value is present in between "RX packets " and "bytes". When I run the command above it ends up giving me the full ifconfig response but with the text "RX packets " and "bytes" removed.


Members online