[LBo] looking for command
Chris F.A. Johnson
cfajohnson at teksavvy.com
Sun Mar 18 19:30:56 CET 2007
On Sun, 18 Mar 2007, Jason Armstrong wrote:
>> 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'
There's no need to use sed, either. See my post in this thread.
--
Chris F.A. Johnson <http://cfaj.freeshell.org>
===================================================================
Author:
Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
More information about the QnA
mailing list