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

Ok so this did search this time, My issue is that i need to pull the line that has all of the following true. unknown type(0x134e) 30.6511 (V6.5.1 FP1)

Here is a line from the data file

01 XXXXXXXX 10/Apr/13 01:13:10 unknown type(0x134e) 30.6511 (V6.5.1 FP1) Singer 192.168.1.1

  • 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:40 UTC

    That is even easier. Just one regex.

    use strict; use warnings; use lib "/Library/Perl/5.10.0/"; use autodie; 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 $line =~ /unknown type\(0x134e\)\s+30\.6511\s+\(V +6\.5\.1 FP1\)/; } close OUT; close FILE;