1. Registered User
Join Date
May 2004
Posts
5

I am unable to trace the syntax error reported.... can any one help?

#codefor assert9419
#rchakra18jun2004
function hextodec(hexa) {
result=0;
lon = length(hexa);
#print "long:"lon
for (i = 1; i <= lon ; i++)
{
k = substr(hexa, lon + 1 - i, 1);
#print "k:"k
j=0
if (tolower(k) == "a") j=10;
if (tolower(k) == "b") j=11;
if (tolower(k) == "c") j=12;
if (tolower(k) == "d") j=13;
if (tolower(k) == "e") j=14;
if (tolower(k) == "f") j=15;
if (tolower(k) == 1) j=1;
if (tolower(k) == 2) j=2;
if (tolower(k) == 3) j=3;
if (tolower(k) == 4) j=4;
if (tolower(k) == 5) j=5;
if (tolower(k) == 6) j=6;
if (tolower(k) == 7) j=7;
if (tolower(k) == 8) j=8;
if (tolower(k) == 9) j=9;
#print "j2:"j
result = result + j * 16 ^ ( i -1 );
}
return result;
}
#aeert9419..modified by rajibchak
#dtd:18 june2004
BEGIN{
printf "Cell\tCRC\tCCU\t Unslotted \tSlotted \tOverhead \tCAM\tOrder \tAuthChal \tSSD \tFeatNot \tSDRM \tDBM \tGPM \tECAM \tBSMS\n"}

{
if ( ( \$0 ~ /Assert/ ) && ( \$0 ~ /9419/ ) ) {
#print l;
split( \$0,a );
cell = a[3];
#print cell;
CRC = a[7];
CCU = a[9];
CCU=substr(CCU, 1, 1);
#printf "%s\t%s\t%s\t", cell,CRC,CCU >> salida;
printf "%s\t%s\t%s\r", cell,CRC,CCU;
getline;
getline;
getline;
getline;
getline;
getline;
#print l;
split(\$0,D);
#print D[3]; print D[4];print hextodec(D[4])
printf "%d\t", hextodec(D[3]);
printf "%d\t", hextodec(D[4]);
printf "%d\t", hextodec(D[5]);
printf "%d\t", hextodec(D[6]);
printf "%d\t", hextodec(D[7]);
printf "%d\t", hextodec(D[8]);
getline ;
split(\$0,D);
printf "%s\t", hextodec(D[1]);
printf "%s\t", hextodec(D[2]);
printf "%s\t", hextodec(D[3]);
printf "%s\t", hextodec(D[4]);
printf "%s\t", hextodec(D[5]);
printf "%s\t", hextodec(D[6]);
printf "%s\t", hextodec(D[7]);
printf "%s\n", hextodec(D[8]);
}

......

when run thru
awk -f 9419test.awk /omp-data/logs/aplogs/20040617.DBG|more

... throws
awk: syntax error near line 1
awk: bailing out near line 1

pl help....

I tried putting the function statement at the end also... but it says the same at the line containing the function statement...

2. Registered User
Join Date
Apr 2004
Location
Boston, MA
Posts
325
you have dis-ballanced '{' for action block - not sure if you have it in your original file - missing closing '}'. Check your parents:

{
if ( ( \$0 ~ /Assert/ ) && ( \$0 ~ /9419/ ) ) {
.....
.....
}

}

3. Registered User
Join Date
May 2004
Posts
5
it was just a cut paste error...

I do have it in my original file...

the error is the same..

pl help

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•