SO I have this file of mac addresses . only the last six digit pairs are the mac address.
Code:
312.47B 31 00 15 17 81 4D 94
312.47B 32 00 15 17 9B AF AC
312.47A 14 00 15 17 64 0C 6C
312.47A 15 00 15 17 81 DD D4
312.48B 33 00 15 17 99 97 10
312.48B 34 00 15 17 81 A3 F0
312.48B 35 00 15 17 C1 02 A0
and I have this code:
Code:
#!/usr/bin/perl
open FILE, "/tmp/foo" or die $!;
while (<FILE>) {
$string = $_ ;
chomp $string;
if ($string =~ /\d{2}\s+(\d{2}\s\d{2}\s\d{2}\s\d{2}\s\d{2}\s\d{2})/) {
print $string;
}
sleep 1;
}
and this is all it prints:
312.48B 33 00 15 17 99 97 10
what I want to print is the last 6 digits of each line - space seperated - theyare actuallly mac addresses. Eventually, I want to use the TR values to replace the spcaes with colons.
but first I have to print them out.