1

How to get all lines between first and last occurrences of patterns?

view story
linux-howto

http://unix.stackexchange.com – How can I trim a file (well input stream) so that I only get the lines ranging from the first occurrence of pattern foo to the last occurrence of pattern bar? For instance consider the following input : A line like foo this foo bar something something else foo bar and the rest I expect this output: foo this foo bar something something else foo bar (HowTos)