Need Help !!! simple query

Dear,

I have a alarm text file, containing minor and major alarms, i am intrested in Mojor alarm with its alarm header and next four lines in seperate file....

Can anybody help me with this below is the alarm file output.

:SEV="MAJOR":
Object-Instance %
unit-type % bts nbr % 25
SBL-type % tre nbr % 4 subnb % 255

:SEV="MINOR":
Object-Instance %
unit-type % bts nbr % 8
SBL-type % ra nbr % 2 subnb % 255

:SEV="MAJOR":
Object-Instance %
unit-type % bts nbr % 24
SBL-type % tre nbr % 4 subnb % 255

awk>outfile '/MAJOR/' ORS="\n\n" RS= infile
perl>outfile -00 -nle'print if /MAJOR/' infile
ruby>outfile -00 -nle'print if /MAJOR/' infile

Dear radoulov,

Thanks a lot for the quick reply.

Can you please tell me what is representing first and second "n" below with ORS.
Thanks a lot

awk>outfile '/MAJOR/' ORS="\n\n" RS= infile

The \n sequence represents a new line. You need to set the Output Record Seperator to two new lines because the default is one and the output will be like this:

:SEV="MAJOR":
Object-Instance %
unit-type % bts nbr % 25
SBL-type % tre nbr % 4 subnb % 255
:SEV="MAJOR":
Object-Instance %
unit-type % bts nbr % 24
SBL-type % tre nbr % 4 subnb % 255

How about just:

grep -A 3 'MAJOR'

Or, if you want to be sure you get exactly what you ask for:

grep -A 3 -E '^:SEV="MAJOR":$'

First the A B switches are available only in GNU grep,
second, the above solution handles only a fixed length paragraphs.