hi,
I want to print all the lines between the matching braces.
For example,the file contains like the below.
asdfsdf
fsdfsd
WO{
w1{
ada
}
w2
{
}
}
sdfsdf
Here i want to print all the lines between WO{ and its corresponding closing brace.
This is very urgent, can somebody help me pls...
nawk '{
if(index($0,"WO{")!=0)
f=1
if(index($0,"{")!=0)
l++
if(index($0,"}")!=0)
l--
if(f==1 && l>0)
print
}' filename
Hi..Thanks for the code, but the output is missing the actual brace, instead it is printing the last but one brace.
dude, I got it. I added an extra flag to print that matching brace.
Thank u very much, u made it so simple.!!!