Your question is still a bit unclear. Are there two different formats inside a single log? Or are you trying to extract info from two different logs, with different timestamps? I'm guessing the latter, but how about giving us an actual example of the input and desired output?
In any case, tools like
grep and
sed are very limited in this kind of situation, as they can only match exact text strings (and regex variations thereof). So you'd need to enter at least part of the timestamp
exactly. That is, if you want to get everything starting from, say, "May 31 2012 7:30:00", and the only entries in the log are "May 31 2012 7:29:59" and "May 31 2012 7:40:01",
sed probably won't find anything. You'll need to use something more complex that can compare relative times.
Since you mention
perl, I wouldn't doubt there's a perl module out there ready made for parsing logs, so I recommend searching cpan.org for what they have on offer.
gnu awk also has a set of built-in time manipulation functions. It should be possible to build a decent awk script using them. Here's the documentation for them:
http://www.gnu.org/software/gawk/man...Functions.html
Finally, there was also a poster here recently who offered up a package of tools he's written called
dateutils, one of which, dgrep, can extract lines of text based on relative timestamps.
http://hroptatyr.github.com/dateutils/