Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: How grep IP-addresses that is an exact match?

by The Mad Hatter (Priest)
on Apr 02, 2004 at 23:01 UTC ( #342174=note: print w/ replies, xml ) Need Help??


in reply to How grep IP-addresses that is an exact match?

Changing grep /$host/, (@ip) to grep /^\w,$host$/, (@ip) should work (by requiring the pattern (the IP) to compose the entire line). Also be aware that . is a regex metacharacter (match anything but \n), and so the line above really should be grep /\w,\Q$host\E$/, (@ip) to escape any metachars in $host.

Update Didn't see the a, ... b, ... c, ... in ip.txt at first.


Comment on Re: How grep IP-addresses that is an exact match?
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://342174]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (5)
As of 2015-07-06 05:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (70 votes), past polls