#!/usr/bin/perl -w
use strict;
use warnings;
# my $log = "log";
# my $log_string = "grep '^8=' $log |";
# usage ();
chomp (my $TAB_1 = $ARGV[0]);
chomp (my $TAB_5 = $ARGV[1]);
shift ; shift ;
# open (my $HAN, "$log_string") || die "Problems grepin... : $!";
# my @contents = <$HAN>;
# my $matches = grep /1=$TAB_1 && 5=$TAB_5/, @contents ;
my @contents = <>;
# my @matches = grep /1=$TAB_1 && 5=$TAB_5/, @contents ;
my @matches = grep /$TAB_1/ && /$TAB_5/, @contents ;
foreach (@matches)
{
print "[+] FOUND $TAB_1 and $TAB_5 in\n",
"-----------------------\n",
"$_" ;}
producing:
% ./s1
Environment: LC_ALL = C, LANG = C
(Versions displayed with local utility "version")
OS, ker|rel, machine: Linux, 2.6.26-2-amd64, x86_64
Distribution : Debian GNU/Linux 5.0.7 (lenny)
GNU bash 3.2.39
perl 5.10.0
-----
Data file data1:
a
b
a b
x
a z
x y
z
-----
Results of ./p1 a z data1:
[+] FOUND a and z in
-----------------------
a z