regex - How to extract all ifconfig data in awk except loopback -
i writing script includes function list interfaces except loopback ifconfig. logic i'm using loopback block regular expression , negating it. command use ifconfig|awk '!/lo:/,/\n\n+/'
still returning interfaces. when remove !
, loopback address returned. why earlier command returning instead of except loopback?
you can use awk
:
ifconfig | awk 'begin{ors=rs="\n\n"} !/^lo/{print}'
Comments
Post a Comment