in reply to system command question
One other item: You don't really need the cat statement, as grep can read from the file just as easily as it can read from the pipe:
grep eth0 /proc/net/dev | awk '{print $2}' | sed 's/eth0://g'
then, of course, you really don't need the grep, either, as awk knows how to run a block only when it finds a regular expression:
awk '/eth0/ {print $2}' /proc/net/dev | sed 's/eth0://g'
After that, we don't really need the sed statement either, as awk can also do a regular expression substitution:
Of course, since this is a perl site, you might just want to use perl...awk '/eth0/ {print gensub("eth0","","g",$2); }' /proc/net/dev'
...roboticus
|
|---|