in reply to Re^3: Using grep to pick out Specific lines in a text file
in thread Using grep to pick out Specific lines in a text file

well i tried what you have above and it tells me there is a syntax error at line 5
  • Comment on Re^4: Using grep to pick out Specific lines in a text file

Replies are listed 'Best First'.
Re^5: Using grep to pick out Specific lines in a text file
by hdb (Monsignor) on Apr 11, 2013 at 20:21 UTC

    Here is a version that tries to heed davido's advice:

    use strict; use warnings; use lib "/Library/Perl/5.10.0/"; use autodie; my @patterns = ( 'unknown type\(0x134e\)', '30.6511', '\(V6.5.1 FP1\)' + ); open FILE, "<", "data/04102013_loginlogs.txt" or die "Cannot open inpu +t file.\n"; open OUT, ">>", "output.txt" or die "Cannot open output file.\n"; while( my $line=<FILE> ) { print OUT $line if scalar grep { $line =~ /$_/ } @patterns; } close OUT; close FILE;
Re^5: Using grep to pick out Specific lines in a text file
by hdb (Monsignor) on Apr 11, 2013 at 20:08 UTC

    One ) too much. Sorry. I will correct it.