use warnings; use strict; my $filename = $ARGV[0]; open(INFILE, "<", $filename) or die "Cannot open $ARGV[0]"; my(@fcont) = ; $dir =~ m/[a-z]:\\.*?\n/g; foreach $line (@fcont) { if ($line =~ m/(New File|New Dir)\s+([0-9]+|[0-9].[0-9]\s[a-z]?)\s+(.*?\n)/g) { print join("|",$ARGV[0],$1,$dir,$2,$3); } } close( INFILE );