[LBo] looking for command

Jason Armstrong jarmstrong at gmx.net
Sun Mar 18 19:18:20 CET 2007


> I could do this for ipv4 of my wireless card:
> 
> ifconfig wlan0 | grep "inet addr" | sed -e "s/inet addr://" | \
> sed -e "s/ Bcast.*//"
> 
> Putting it into a shell script should be simple enough

That's some mad pipage.  If you're using sed there's no reason to use grep at all:

ifconfig eth0 | sed -n 's/^.*addr:\(.*\)  B.*$/\1/p'

Cheers,

Jason


More information about the QnA mailing list