Suppose you are searching among the files setenv.sh and setenv.sh.tpl for the line containing
Djava.rmi.server.hostname
and you need to output that line along with the next 5 lines. Then use:
find . -type f -name 'setenv.sh*' -exec grep -I -nH -A5 'Djava\\.rmi\\.server\\.hostname' {} \;
Here, -I ignores binary files.
If you need to add 2 lines before, then:
find . -type f -name 'setenv.sh*' -exec grep -I -nH -B2 -A5 'Djava\\.rmi\\.server\\.hostname' {} \;
Instead of -B2 -A5, you can use -C5 if you want 5 lines before and after.