How to grep using a line break in regular expressions?

Hi,

I have a file as below,

{####
if file
then
file
else
file
}
print file

i need to fine the count of all the pattern - file, inside the { }

i'm using a grep command as

grep -c \{'[a-zA-Z0-9 ]file[a-zA-Z0-9 ]'\} fake.sh\

It doesn't gives me any result, i think the problem here is the line breaks in the paranthesis, so how can i include the line breaks in the regular expression???

Need ur suggestions!!

Thanks

Try:

sed -n '/{/,/}/ { /file/ p}' file | wc -l

have you solved your problem you posted here

The script u have provided doesn't works,

I'm working in KSH, will that be a problem?

---------- Post updated at 12:42 AM ---------- Previous update was at 12:40 AM ----------

Thanks for the response,

But it throws this error

sed: Function /{/,/}/ { /file/ p} cannot be parsed.

Please note i'm working in KSH

then why didn't you update on that thread that it doesn't work instead of starting a similar one? have you tried the rest of the solutions? by the way, just a simple grep like that would not solve your problem.

That's my mistake

However, it was a lot of learning.

I'm new to shell scripts and i don't have any idea on this.

Could u pls make this work? it would be really helpful.