Awk trick 2
>>-- 13 September 2013 --<<
nawk 'c-->0;$0~s{if(b)for(c=b+1;c>1;c--)print r[(NR-c+1)%b];print;c=a}b{r[NR%b]=$0}' b=2 a=4 s="string" file1
where "b" and "a" are the number of lines to print before and after string "s".
Thanks
~ aks
Useful those who are looking for solution in Unix WebLogic, WebSphere and going to write Certification and for future learner