I have a simple question. I have a file containing:
more random text
*foo*
there
is
random
text
here
*foo*
foo
even
more
random
text
here
foo
more random text
(to clarify between which parts i want the result from, i added the *'s next to foo. The *'s are not in the file.)
I only want to print out the multiple lines between the first 2 instances of foo.
I tried searching for ways to let "foo" occur only once and then remove it. But i didnt get that far. However i did find the way to remove all the "more random text" using: sed '/foo/,/foo/p' but i couldnt find a way using sed, or awk to only match ones and print the output.
Can anyone help me out?