in reply to Re: elementary hash
in thread elementary hash, STDIN questions

The regex's are stripping unwanted text from each line of the input file.   Basically, I'm cleaning up logfiles to make them easier to read at a glance.
    cheers,
    ybiC

Replies are listed 'Best First'.
RE: RE: (2) elementary hash
by adamsj (Hermit) on Sep 12, 2000 at 01:27 UTC
    The answer ncw gave on how to join the patterns into a regex is just right--you have nice, simple patterns.

    Are you interesting in something that applies one regex to a one sort of log file and another regex to another sort? If so, you're nearly there. If you can parse the input filenames (or the output filenames, come to think of it) to get a unique string corresponding to each type of file you want to edit, then you could put the pattern into a hash based on the string you parsed out of the file names. If you don't have many types of files, that's a good solution.

    If you have a _lot_ of types of files, or if the regex is going to change a lot, I'd consider biting the bullet and writing a config file. Then, once you've parsed the file name, get the regex for that type of file from the config.

      I hadn't thought it out that far, adamsj.   For the moment, I'll be applying the scriptlet to just one specific set of logfiles and regex's, but that could change in the future.
          cheers,
          ybiC