SystemVerilog $feof()

Hi people,
I want to activate something 3 lines before the end of the text file being read, how can I do that ?
Basically how can I identify ‘x’ lines before the end of the file ?

Thanks in advance!