S
shahriar_saberi
Hi all,
I am trying to write a program that scans a large log file and only
extracts the lines that pertain to an error message and writes it to a
different line. Basically the log file will be of this format :
Junk Junk ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~```
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~```
Error.............................................\n
Junk Junk Junk~~~~~~~~~~~~~~~~~~~~~~~~~~~~````
Error..............\n
So between the junk text there will be these long Error strings that
are terminated by a new line.
Now I know how to open the actual file and also looked up the tgrep
function but I don't know how to put it all together.
I guess the algorithm would be to find
-first instance of Error
-read everything between Error and the newline character into a vaiable
-open the target file and write the buffer into the target file
If anyone can guide me with some key perl commands or guide me to the
right direction I would really appreciate it.
Thanks,
Shah
I am trying to write a program that scans a large log file and only
extracts the lines that pertain to an error message and writes it to a
different line. Basically the log file will be of this format :
Junk Junk ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~```
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~```
Error.............................................\n
Junk Junk Junk~~~~~~~~~~~~~~~~~~~~~~~~~~~~````
Error..............\n
So between the junk text there will be these long Error strings that
are terminated by a new line.
Now I know how to open the actual file and also looked up the tgrep
function but I don't know how to put it all together.
I guess the algorithm would be to find
-first instance of Error
-read everything between Error and the newline character into a vaiable
-open the target file and write the buffer into the target file
If anyone can guide me with some key perl commands or guide me to the
right direction I would really appreciate it.
Thanks,
Shah