[Gllug] Help with Script.
Martin N Stevens
budgester at budgester.com
Mon Jan 10 15:24:38 UTC 2011
Hi,
I am trying to write a script that will collect all the mac addresses
on my network, it will be run periodically to update a file called
mac.txt
However the matching part doesn't seem to be working. Any clues please.
================================
#!/bin/bash
nmap 10.72.92.0/22 -sP | grep MAC | cut -d " " -f3 > live.txt
cat live.txt | while read line; do
grep $(line) mac.txt > /dev/null 2>&1
if [ $? -eq 1 ]; then
echo "Mac not known $(line). Adding to mac.txt file"
echo $(line) >> mac.txt
fi
done
rm live.txt
================================
Regards
Martin Stevens
--
Work: 01992 703382 - Mobile: 07815 982380
Think Green - don't print this email unless you really need to.
--
Gllug mailing list - Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug
More information about the GLLUG
mailing list