I have to cut a long file (approx. 2 millions of lines) at the line that follows the line at which there is the last appearance of a word.
For example the file could be:
line 1
line 2
....
word
line n
word
line n+2
This file should be cut at the second appearance of word, so the lines following line n+2 (and that line too) should be dropped.
The problem is that I do not know in advance the number of times word appears in the file.
0 Answers