So let's say I have a file that contains the following text:
string1
string1
string2
string1
string2
string1
string1
And I wanted to get rid of all text after the last occurrence of "string2". For example the output would look like this:
string1
string1
string2
string1
string2
What's an easy way to do this in bash?