It doesn't appear that there is a built-in way to determine which line you are currently on. As I mentioned before, you could make some convoluted script to count the linebreaks somehow.

Maybe one of the file commands has undocumented arguments. Like adding ,-1 to the $fread identifier. Maybe the $readn identifier also works on the file commands.

Otherwise, this looks like an opportunity for a feature suggestion.

-genius_at_work