[Gllug] Help with Script.

Martin N Stevens budgester at budgester.com
Mon Jan 10 15:24:38 UTC 2011


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

However the matching part doesn't seem to be working. Any clues please.



nmap -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

rm live.txt



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

More information about the GLLUG mailing list