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