lispnewlisp

return a line of text if match found


I am having some trouble working out how to return a line of text if a match is found.

(set 'wireshark "http://anonsvn.wireshark.org/wireshark/trunk/manuf")

(set 'arptable (map (fn (x) (parse x " ")) (exec "arp -a")))

(define (cleanIPaddress x)
  (slice x 1 -1))

(define (cleanMACaddress x) 
  (upper-case (join (slice (parse x ":") 0 3) ":")))

(define (addIPandMACaddress x) 
  (list (cleanIPaddress (nth 1 x)) (cleanMACaddress (nth 3 x))))

(set 'arplist (map addIPandMACaddress arptable))

(set 'routerMAC (last (assoc (exec "ipconfig getoption en1 router") arplist)))

(find-all routerMAC (get-url wireshark))

returns

("20:AA:4B")

so I know that the code "works"

but I would like to retrieve the full line of text

"20:AA:4B Cisco-Li # Cisco-Linksys, LLC"


Solution

  • In the end I used:

    (find-all (string routerMAC ".*") (get-url wireshark))