Re: Bash scripting help...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux