Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Re: Grep Pattern Match

by LostS (Friar)
on Dec 27, 2002 at 15:46 UTC ( [id://222556]=note: print w/replies, xml ) Need Help??


in reply to Re: Grep Pattern Match
in thread Grep Pattern Match

Thank you... Your nudge got me in the right direction. here is the code I am using: @files = grep {/^nc$digyear$digmon.*\.log$/} @files; Works like a charm :)

-----------------------
Billy S.
Slinar Hardtail - Hand of Dane
Datal Ephialtes - Guildless
RallosZek.Net Admin/WebMaster

perl -e '$cat = "cat"; if ($cat =~ /\143\x61\x74/) { print "Its a cat! +\n"; } else { print "Thats a dog\n"; } print "\n";'

Replies are listed 'Best First'.
Re^3: Grep Pattern Match
by diotalevi (Canon) on Dec 27, 2002 at 16:02 UTC

      Slightly dangerous if the application calls for using the regex in a loop where one of the variables (eg. $month) changes, as unless the qr// is also inside the loop (in which case the optimisation benefits are lost), as the changing value of the variable won't be recognised.


      Examine what is said, not who speaks.

        I am not really going for optimisation (yet)... just want a script that will parse my log files that will search for attempted DOS's and stuff and then take those IP's and add them to our deny list. That is all I am writing this for.

        -----------------------
        Billy S.
        Slinar Hardtail - Hand of Dane
        Datal Ephialtes - Guildless
        RallosZek.Net Admin/WebMaster

        perl -e '$cat = "cat"; if ($cat =~ /\143\x61\x74/) { print "Its a cat! +\n"; } else { print "Thats a dog\n"; } print "\n";'

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (7)
As of 2024-04-18 06:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found