Results 1 to 2 of 2
Hi I am trying to write a script that would look at the result of arp -a and get the MAC address of an ipaddress.
Here is what I have.
...
- 02-13-2007 #1
bash scripting
Hi I am trying to write a script that would look at the result of arp -a and get the MAC address of an ipaddress.
Here is what I have.
arp -a | awk '192.168.0.$LASTDIGIT {print $4}'
I get an error message saying
awk: 1: unexpected character '.'
Any ideas,
thanks
- 02-13-2007 #2
Try:
That'll print MAC address for everything arp displays in the /24 network.Code:arp -a | awk '/192.168.0./{ print $4 }'
What is it you're trying to do with $LASTDIGIT? Expand a variable you've assigned a value to in the shell? If so, then use:(make sure you copy that exactly.)Code:arp -a | awk '/192.168.0.'"$LASTDIGIT"'/{ print $4 }'


Reply With Quote
