capture data from matched string/line

Hi,

I have a query as follows :

suppose I am matching a string in a file say "start from here"
and I want to pick up 'n' number of lines () from the matched string. Is there any way to do that ?

1) going forward I want to do this for every match for the above string
2) or limit this to only 1 occurrence/ 'n' occurences

Thanks in advance.

"n" lines from a match, this is one way with awk.

lines=3
 awk -v lines=$lines '/start from here/ {n=lines} n {n--;print}' myfile > newfile

Thanks!

but in my case it did not work. I ran it on the following para from wiki abt grep

stored it in a file names "Text"

and ran..

lines=5 
awk -v ln=$lines '/may also behave/ {n=ln} n {n--;print}' Text

is there a BEGIN required ?