List all log records logged after $timestamp ?

I am trying to find a way to list every records inside a file (usually a log file) that are present after a record mathing/greater-then a timestamp supplied by another script.

The timestamp can be anywhere inside the record and it is usually in the standard `date` format (will not look for other formats).

ex:
Tue Jun 16 03:47:58 EDT 2009

I thought of using awk (on client's AIX 4.2) with index(str,regex) but that function does not see any timestamps inside the records (copied code below from memory).

awk -F" " '{
WHICHPOS=index($0,"[A-Z][a-z][a-z] [A-Z][a-z][a-z] [0-3][0-9] [0-2][0-9]:[0-5][0-9]:[0-5][0-9] * 20[0-9][0-9]")

if ( WHICHPOS > 0) print WHICHPOS, NR, $0
}' /tmp/a_file

At first the * was producting verry odd results (was replaced by content of `ls *`). So I removed the " * 20[0-9][0-9]" part.

But then, it never sees any timestamp (I checked the file content).

I am beginning to wonder what kind of regular expression that index() can take.

Is there a timestamp pattern available in regular expressions ?

use code tags
then share your input file with more records...
code you are trying
and expected output...

To me, what you are saying does not make sense.

Its okay.. I just wanted you to use code tags and show me the output you wanted with the sample of input records. :slight_smile:

I have no direct way of putting here file samples. All the files I want to use this method all have different formats, different infos but all have standard `date` format infos. The current file I am testing has records looking like :

As for the code tags, if you mean using clear coding methods, I was just doing a quick test to see if it is feasible. Cleaner code would come next if it works.

try this

WHICHPOS=match($0,"[A-Z][a-z][a-z] [A-Z][a-z][a-z] [0-3][0-9] [0-2][0-9]:[0-5][0-9]:[0-5][0-9] [A-Z][A-Z][A-Z] 20[0-9][0-9]")

PS:- By using code tags, I meant putting [code] around your code, like I have done just now.