perl -lne '$c=11if/pattern/;$c--,print if$c' file