NTGeek has asked for the wisdom of the Perl Monks concerning the following question:
Dear Monks,
This will be my first post - Indeed, I am working on my first attempts at PERL, so my knowledge is extremely rudimentary. I assure you that I have gnawed on a few pencils before posting this.
I have a log file ('dread-etc.log'). Inside of that log file are the following phrases. . .
"this message has no use whatsoever" "data, blah, blah, blah" "this message has no value, only confusion" "data, blah, blah, blah" "this is a bad error message" "data, blah, blah, blah"
My goal is to be able to run a perl script against this file so that it pulls out only the data (pattern?) that I have defined ("this is a bad error message"). Since this hypothetical file is filled with all types of nonsense, I want to be able to pull out only what I want and create another file. For now, even if the file is empty that would be a good start.
I think that the poor man's logic behind this would be.
a. open the dreadetc.log file b. search the dreadetc.log file for specific error messages ($x = "thi +s is a bad error message") c. write out a new log file called only_the_dread.txt
I thank you for your time in advance,
Doc Wally
Update:
Dear Monks,Thanks for the replies. I am actually on a Windows machine.
Any assistance is greatly appreciated.
Regards and thanks,
Doc Wally
20080701 Janitored by Corion: Restored original content, added formatting, code tags, as per Writeup Formatting Tips
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Locating "Patterns" in a log file (e.g. keywords, etc)
by almut (Canon) on Jun 30, 2008 at 19:40 UTC | |
|
Re: Locating "Patterns" in a log file (e.g. keywords, etc)
by apl (Monsignor) on Jun 30, 2008 at 19:49 UTC | |
|
Re: Locating "Patterns" in a log file (e.g. keywords, etc)
by linuxer (Curate) on Jun 30, 2008 at 19:39 UTC | |
|
Re: Locating "Patterns" in a log file (e.g. keywords, etc)
by linuxer (Curate) on Jun 30, 2008 at 21:26 UTC |