I am trying to parse a lot of game server log files to get some relevant info(New connections, player kicks etc.). I have no experience in perl whatsoever so I could use a little help.

My questions are:
How do I 'import' the regular expressions I want to search from a file? Let's say I have 20 regexps I search for and they are in a file 'searchlist'.

----
The file structure where the logs are is:
~/logs/serverIP_PORT/date.log<br/> e.g.: ~/logs/1-1-1-1-2222/20080917.log

Is there a way to search all .log files with a specific date, regardless of the serverIP_PORT folder they are in? So instead of looping through all the serverIP_PORT folders -> do it in one go.

----
I need to add some information infront of every line that contains one of the regexps. For example there is a new connection:
[2008-01-01 11:00] New Connection (slot #1) name IP
The perl scrips will find this(it searches for New\sConnection) but it needs to add the serverIP infront of this line(it gets the serverIP from the folder where the .log file is in, see previous question).
Does this limit me to line-by-line searching of every logfile(rather than: perl -ne 'print if (m/(New\sConnection)/i)' test.log)

I'm sorry if I'm asking too much, but my time is rather limited here so learning the ins and outs of perl isn't really an option at the moment. If anyone could push me in the right direction (especially for the first and last question ^^) I'd be very grateful

In reply to Log parsing question by thelamb

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.