I have my inputfile in the following format :
From:sdhfhg
dsfhsdjfjdsfh
dsfjdjshjsd
djfhsdjfjsdhjds
Error Description
<aa.aa.aa.aa.aa.aa>
From:ksljfsdhfjh
djfdsjkf
sdjwoquk
dsfsdfj
Error Description
<dd.dd.dd.dd.dd>
I want to read the lines from tag 'From:' thrul <aa.aa.aa.aa.aa.aa> similarly for the next block. Next I want to read the Error Description and assign an codenumber to it.
I am using the following code :
#this is my first awk program
BEGIN {errorcode=0}
/From/ {take actions}
#Read until next 'From'
{while!(^/<[a-z]/)
if (/ErrorDesc1/) print "01"
else if(/ErrorDesc2/) print "02"
else if(/ErrorDesc3l/) print "03"}
{if(errorcode != 01 && errorcode != 02 && errorcode != 03) print "04"}
I get the following error :
The error context is
>>> {while! <<< (^/<[a-z])
awk: The statement cannot be correctly parsed.
The source line is 13.
Can someone guide...I am new to awk programming.