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
Since checking for "foo" (using /foo/) is relatively expensive, the following avoids that check and will work with all awks worthy of the name:
/foo/
awk
awk 'c==2 {next} /foo/{++c;next} c==1' file