troubleshooting Question

Perl check values

Avatar of bt707
bt707Flag for United States of America asked on
5 Comments1 Solution296 ViewsLast Modified:
I'm using a Perl one liner to parse out some info, where I need to see if the set City matches a part of another value such as:

perl -n00e 's/\n //g;if((/employeeType: (contractor|director|employee|student|role)/mi)){print STDOUT m/^id: (.+)/mi,qq{\t},m/^alias: (.+)/mi,qq{\t},m/^c: (.+)/mi,qq{\t},m/^l: (.+)/mi,qq{\t},m/^itbuilding: ([^_]+(?=_)).+/mi,qq{\n}}'

From this one liner I get an output such as:

100151  boulter1        GB      Crawley Crawley
100152  boyden1 US      Princeton       Tulsa
100153  acampbell       US      Houston Houston
100163  nickson1        NL      The Hague       The Hague
100166  asalsman        AE      Abu Dhabi       Mussafah

What I need is the lines where the last two fields do not match, how can I print out just the ones the do not have the last two fields matching and also a way to print out all but mark the ones that do not match with a 6 field such as Match/No Match.

From that example I need the two lines that do not match the last two fields:

100152  boyden1 US      Princeton       Tulsa
100166  asalsman        AE      Abu Dhabi       Mussafah

perl -n00e 's/\n //g;if((/employeeType: (contractor|director|employee|student|role)/mi)){print STDOUT m/^id: (.+)/mi,qq{\t},m/^alias: (.+)/mi,qq{\t},m/^c: (.+)/mi,qq{\t},m/^l: (.+)/mi,qq{\t},m/^slbitbuilding: ([^_]+(?=_)).+/mi,qq{\n}}'
Join our community to see this answer!
Unlock 1 Answer and 5 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros