Hmm, here's what I have, and I'm getting a "use of unitialized value" error for s1 and s2:

#!/usr/bin/perl -w
while (my $line = <STDIN>) {
    ($s1,$s2) = $line =~ m/.*object-group (\S*).*object-group (\S*)/;         
	if ( $s1 eq $s2 ) {
		print $line;
	}
}

On Dec 10, 2010, at 5:58 PM, Gerry wrote:

> Oops. Forgot the $line thing.
> ($s1,$s2) = $line =~ m/.*object-group (.*) object-group (.*) log/;
> 
> perl
> $line = "access-list dmz extended permit ip object-group SOMETHING1 object-group SOMETHING2 log";
> ($s1,$s2) = $line =~ m/.*object-group (.*) object-group (.*) log/;
> print $s1,"\n";
> print $s2,"\n";
> SOMETHING1
> SOMETHING2
> 
> 
> On Fri, 10 Dec 2010, Gerry wrote:
> 
>> like this?
>> 
>> ($s1,$s2) = m/.*object-group (.*) object-group (.*) log/;
>> # The spaces take care of the terminations.
>> if ( $s1 eq $s2 ) {
>> print;
>> }
>> 
>> 
>> On Fri, 10 Dec 2010, Jay Austad wrote:
>> 
>>> Say I have a file full of lines that look like the following:
>>> access-list dmz extended permit ip object-group SOMETHING1 object-group SOMETHING2  log
>>> I need a perl script that takes in each line, compares SOMETHING1 to SOMETHING2, and then prints the original line ONLY if they match.  Not all of the lines have the same number of columns, and I also need to ignore lines that only have one "object-group" in them.
>>> I'm thinking some sort of regex like this would work, but I'm unsure how to impelment, and ned to get this done fast:
>>> / object-group (\S+).+object-group (\S+)/
>>> I think that's how you pull matches out of a regex, but I forgot how to reference them, or even to check my $line variable against them that is populated while going through a while loop.
>>> Can someone help?  I'm really in a pinch.
>>> Thanks!
>>> ~jay
>>> _______________________________________________
>>> TCLUG Mailing List - Minneapolis/St. Paul, Minnesota
>>> tclug-list at mn-linux.org
>>> http://mailman.mn-linux.org/mailman/listinfo/tclug-list
>> 
>> 
> 
> -- 
> Gerry Skerbitz
> gsker at skerbitz.org
> 

--
jay austad  |  612.423.1433  |  austad at signal15.com