Issue
I need help with a regex to extract mac addresses from a large file.
Here is the format of the file:
Wed Apr 25 10:15:32 EDT 2012 Client: 00aa11bb22cc mac
Wed Apr 25 10:15:34 EDT 2012 Client: aa11bb22cc33 pc
Here is what I am currently trying with no luck:
grep -io '[0-9a-f]{12}' file.txt > macs.txt
Any ideas? I just want to extract only the mac address part into the file called macs.txt
.
Solution
Try:
grep -io '[0-9a-f]\{12\}' file.txt > macs.txt
Answered By - MattH Answer Checked By - Gilberto Lyons (WPSolving Admin)