Sometimes it is necessary to use regular expressions in various scripts.
Here are some useful regular expressions that can also be used with standard grep
A couple of grep options
-E, --extended-regexp PATTERN - interpret PATTERN as an extended regular expression
-o, --only-matching - output only the matching part
Selecting IP addresses
grep -E -o '[0-9]{1,3}(\.[0-9]{1,3}){3}'
Selecting MAC addresses
grep -E -o '[0-9,aAbBcCdDeEfF]{1,2}(\:[0-9,aAbBcCdDeEfF;]{1,3}){5}'
