Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

Re: Untangling Log Files

by kwaping (Priest)
on Feb 08, 2007 at 17:36 UTC ( [id://599066] : note . print w/replies, xml ) Need Help??

in reply to Untangling Log Files

Non-perl answer: Personally, I would use the unix grep command to extract the desired lines out of the log files, then redirect that output into another file, possibly with a sort wedged in the middle. This is on a unix box though, not sure what your OS is or if there's an equivalent set of commands for it.

Something like this:
grep -h process_identifier *.log | sort -options > process_identifier. +newlog

It's all fine and dandy until someone has to look at the code.

Replies are listed 'Best First'.
Re^2: Untangling Log Files
by loris (Hermit) on Feb 09, 2007 at 07:19 UTC

    Your suggestion is pretty much what I am doing already, but I want to automate the process a bit more so that I can generate the all the process-specific log files at once. So I think I shall try something like jettero's solution.

    Thanks anyway,


    "It took Loris ten minutes to eat a satsuma . . . twenty minutes to get from one end of his branch to the other . . . and an hour to scratch his bottom. But Slow Loris didn't care. He had a secret . . ." (from "Slow Loris" by Alexis Deacon)
      I see. Well, in "quick and dirty" style, you could wrap that system call in a foreach my $process ('this','that','the other') { ... } loop.

      It's all fine and dandy until someone has to look at the code.