Pattern search in multiple lines

Hi,

I have to search those statements from the file which starts from "shanky"(only shanky, shanky09 or 09shanky is not allowed) and ends with ");". These two string can be in a same line or different line. And also i have to negate those lines which starts with #.
Can any one please give me clue how to proceed.

thanks
Shanky09

try this:

sed -n '/ shanky /,/\)/p' inputfile > outputfile 

It would really be better if you were to show actual data. For example - the sample code above won't work if shanky is at the beginning of a line.

The solution given sed -n '/ shanky /,/\)/p' gives below mentioned error

sed: -e expression #1, char 15: Unmatched ) or \)

and shanky can be at the start of line and there is no checking for # also
I mean it should not contain # at start like "#shanky" or "# shanky" or " # shanky" but it can have "shanky#" or "sha#nky";