#finding @dh.nl #!/usr/bin/perl -w my $file="logs1"; chomp $file; open (FILE, $file) || die "Can't open logs file: $!\n"; my @line =(); chomp (@line); foreach (@line){ if (/(\D+)(@)(dh.nl)/) { $a=$1; $b=$2; $c=$3; } } print "$a"."$b"."$c"."\n"; close FILE; #### 193.10.168.23 - - [07/Jan/2013:00:07:48 +0000] "GET /UserFiles/File/Radio%203rd%20Newsletter%20for%20web.pdf HTTP/1.0" 304 - "-" "gsa-crawler (Enterprise; M2-N7RQ5RABCA2JT; qwerty@dh.nl,abcde@dh.nl)"