Thursday, June 26, 2014

grep or less for MAC address using regex

Easy enough:

grep -i '\([0-9A-F]\{2\}[:-]\)\{5\}\([0-9A-F]\{2\}\)' file.txt

Or less
less file
/([0-9A-F]{2}[:-]){5}([0-9A-F]{2})

No comments:

Post a Comment