Bash scripting help...

Jacques B. jjrboucher at gmail.com
Mon Aug 7 22:22:53 UTC 2006


Or even easier:

ip=$(/sbin/arping -f -I eth0 10.255.255.1 | grep Unicast | awk '{print
substr($5,2,17)}')

This greps for the line with the MAC, then using awk prints out the
5th field (space delimited by default so this is the MAC with the [
and ]), and using substr I carve out the MAC by saying I want the 5th
field ($5), starting at the 2nd character, for 17 characters.

Jacques B.




More information about the fedora-list mailing list