Home > Net >  Matching multiple MAC address in arp-scan's output
Matching multiple MAC address in arp-scan's output

Time:02-02

I'm using this sudo arp-scan --localnet | awk '/b8:27:/ { print $1 }' to find Raspberry pis on my network based on a partial Mac address and I was wondering how I can display multiple awk print results using one single line without repeating the same command?

Raspberry pi's use the following ranges:

dc:a6:
b8:27:
e4:5f:
28:cd:c1:

This works, but only with one single Mac.

sudo arp-scan --localnet | awk '/b8:27:/ { print $1 }'

CodePudding user response:

Just add them all to the regex (at least that's what I think you were asking for, your question isn't very well worded) - the pipe | functions as an or:

sudo arp-scan --localnet | awk '/b8:27:|dc:a6:|e4:5f:|28:cd:c1:/ { print $1 }'
  • Related