Looking for command line tool (awk, sed, etc.) command to omit lines from the beginning of a file to the nth occurrence of a pattern. Stated another way, print only from the nth occurrence of pattern to end of file. Assume one match per line; line does not necessarily begin with pattern.
e.g. omit from beginning of file to second foo in the following:
something
abc foo1
maybe something else
foo2 -this line and anything before is gone-
maybe not
foo3
something
Desired result:
maybe not
foo3
something
Bonus points for including/excluding the line with the nth occurrence.