#! /usr/bin/perl use strict; use warnings; while ( defined( my $line = ) ) { # wenn beide Regex zutreffen if ( ( my ( $client ) = $line =~ m/client\s(\S+)/ ) # nach client steht der hostname && ( my ( $mac ) = $line =~ m/cli\s([-\da-fA-F]+)/ ) # nach cli steht die MAC ) { # tu was mit beiden ermittelten Werten print "$client: $mac\n"; } } __DATA__ Wed Mar 23 13:00:28 2011 : Auth: Login OK: [00-11-0A-FA-FB-AA/NOPASSWORD] (from client kgn751 port 31045 cli 00-11-0A-FA-FB-AA) Wed Mar 23 13:01:02 2011 : Auth: Login OK: [00-0B-5D-0B-D6-44/NOPASSWORD] (from client WabeN7-55 port 11031 cli 00-0B-5D-0B-D6-44) Wed Mar 23 13:01:22 2011 : Auth: Login OK: [00-00-85-7B-44-F7/NOPASSWORD] (from client e1-110-west port 36 cli 00-00-85-7B-44-F7) Wed Mar 23 13:01:37 2011 : Auth: Login OK: [00-C4-FF-7F-34-07/NOPASSWORD] (from client e1-111-west port 76 cli 00-C4-FF-7F-34-07) Wed Mar 23 13:05:29 2011 : Auth: Login OK: [08-37-FF-0C-E7-39/NOPASSWORD] (from client e1-140-west port 3 cli 08-37-FF-0C-E7-39)