in reply to Re^2: Extracting Log File data for a given date range
in thread Extracting Log File data for a given date range

I had this problem before. I ended up writing a utility script I call 'grange' for 'grep a range'. It depends on the fact that I'm usually parsing logfiles so the dates are sequential. So I used the range operator .. to match lines between the start and end regexes. If that matches your situation, then here's the whole utility:
#!/usr/bin/perl -n BEGIN { print "Usage: $0 <start pattern> <end_pattern>\n" and exit unless +@ARGV == 2; $start = shift @ARGV; $end = shift @ARGV; } next if 1 .. /$start/; last if /$end/; print
HTH!

Replies are listed 'Best First'.
Re^4: Extracting Log File data for a given date range
by Anonymous Monk on Aug 28, 2012 at 08:56 UTC
    It's a great "fewliner", but won't work if there are no log lines for either start or end position.
      Sure it will