Without having a little more detail on how you identify these lines, I can't give a workable solution. In fact, I can't be certain it's possible, but you could probably do it by cascading grep.
Assuming
regex1 matches all lines like so:
Code:
<unknown random non-numberic garbage> <some number>
And assuming
regex2 matches all lines like so:
Code:
<unknown random non-numberic garbage> notable line
Then something like this might work:
Code:
tac file | egrep "regex1\|regex2" | egrep -A 1 "regex2"
The tac reverses the file like you want.
The first egrep matches both types of lines.
The second egrep prints one line of context after the "notable lines." That first line of context should be the first numeric line like you want.
That is... unless I misunderstood the problem.
EDIT:
Keep in mind, depending on how
regex1 and
regex2 are written, they might need to be surrounded by parentheses to make sure the OR'ing in the first egrep behaves like you want. Again, with some more detail and a sample data file, I might be able to give a working command.