in reply to Perl:how to find multiple strings

You need a program something like this:

#!/usr/bin/perl use strict; use warnings; my $log = 'log'; @ARGV == 2 or die "usage: $0 TAB_1 TAB_5\n"; my ( $TAB_1, $TAB_5 ) = @ARGV; open my $HAN, '<', $log or die "Cannot open '$log' because: $!"; while ( <$HAN> ) { next unless /^8=/; print "[+] FOUND $TAB_1 and $TAB_5 in\n", "-----------------------\n", $_ if / 1=\Q$TAB_1\E / && / 5=\Q$TAB_5\E /; }

Replies are listed 'Best First'.
Re^2: Perl:how to find multiple strings
by auto_w (Novice) on Apr 08, 2011 at 18:04 UTC
    still doesn't make any output --does it work for you?

      It apparently doesn't work because the string "5=8(" is not in any of the lines.

        correct but there is 5=8^A

        Now it works -i just changed to --open (my $HAN, $logg) question --how to add else statement if match not found, i tried adding else but that didn't work out for me ... So far that is the best code i've seen so compact and powerfull---WELL DONE!!!! i wasn't aware of next function...and your ARGV is so nice!!!