Working from this answer, I'm using c)
Print the Nth record after some regexp
awk 'c&&!--c;/regexp/{c=N}' file
to summarise test results (i.e. the test fail detail is two lines after the test suite name that starts with '●'), but I noticed there's some occasions I need to instead print out the 4th line below, if the second line matches a string.
Here are the two cases
● Test Suite > Use case >
Type Error: Illegal constructor
and
● Test Suite > Use case >
Expected test not to call console.error // <--- when I see this...
If the error is expected ...
Warning: Failed prop type ... // <-- ...I want this line
Is there a way to conditionally get the 4th line after if the second line after ● matches a pattern or the second line itself otherwise?