Hi,
The below code will search a particular string(say false in this case) and return me 10 lines above and below the search string in a file.
"
awk 'c-->0;$0~s{if(b)for(c=b+1;c>1;c--)print r[(NR-c+1)%b];print("***********************************");print;c=a;}b{r[NR%b]=$
0}' b=10 a=10 s="false"
"
Further to enhance I want to ignore if the same search string appears in those 10 lines. (Currently this is not happening. For Ex: If the search string exists in 5th line it again starts printing 10lines above and below causing some mess.)
It would be really great if someone could help me on this.
P.S: Being my first post apologies for any mistakes in my post and suggestions welcome.
Thanks,
Vimal