Background:
I'm working on some OBDII software and I'm attempting to automate the connection process via bluetooth. I have a working script but I'd like to further automate it so it'll work on all *nix machines and not just mine (right now the bluetooth device's MAC is stored manually in the script).
My Problem: The output of this command is...
$ hcitool scan
Scanning ...
00:18:56:68:AE:08 OBDII
I need a simple way of piping this into grep (or whatever works) and checking the output for the string "OBDII". If it sees it, then it takes that same line, copies the resulting MAC into a variable while stripping all whitespace and the OBDII identifier at the end, leaving only the MAC to be utilized further down into the script.
What's the simplest way to get this done?
Any help is appreciated!!