If I have a search criterion: She likes to watch tv
Input file text.txt
containing some sentences, e.g.:
I don't know what to do. She doesn't know that it's not good for her health. She likes to watch tv but really don't know what to say. I don't blame her, but it's not her fault. This was just a test text. This is the end.
I want to search for string within the text file, and return the sentence that contains the string, plus the sentence before and after it.
The output should looks like this:
She doesn't know that it's not good for her health. She likes to watch tv but really don't know what to say. I don't blame her, but it's not her fault.
So, it outputs the sentence before the matching search word, the sentence containing the search word, and the sentence after the search word.