I run the following command:
sudo iwlist eth0 scan
and get output that looks like this:
Cell 01 - Address: AB:CD:EF:12:34:56 ESSID:"name" Protocol:IEEE 802.11g Mode:master Frequency:2.417 GHz (Channel 2) Encryption key:on
I won't bother filling it all out, as I'm trying to fix a laptop and I cannot simply copy the output.
How can I use built-in tools such as
sed, etc. to fetch information given certain criteria? For example:
I want to grab the mac address when knowing the essid. I also don't want to rely on the
Cell # or line positions. Knowing common information, like the word Address before the mac is fine.
I want to use it in a variable, like so:
sudo iwconfig eth1 ap $(command)
Where command would result in the expected result. If there's another way of pushing the result as a variable using
> or something, that works as well. (
command > sudo iwconfig eth1 ap $1)