I have found I can use grep -A10 "search string" file.txt
to show 10 lines after the search string is found in the file or grep -B10 "search string" file.txt
to show the 10 lines before. How can I set it to show all of the lines before or after the match?
For example, I have this file:
This is some text.
This is some more text.
This is some text.
This is some more text.
This is some text.
This is some yet more text.
This is some text.
---
This is some more text.
This is some text.
This is some more text.
I need, in the first search, to print all the stuff found before "---", regardless of how many lines there are.
And I need in the second search, to print all the stuff found after "---", regardless of how many lines there are after that.