How to use pipe to parse output of a command How to use pipe to parse output of a command shell shell

How to use pipe to parse output of a command


You can achieve this using awk as shown on this site. I've posted an excerpt here which produces your desired result:

ifconfig | awk '/dr:/{gsub(/.*:/,"",$2);print$2}'


You can do

 ifconfig -a|grep inet| awk -F' ' '{print $2}'