syntax error thrown


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting syntax error thrown
# 1  
Old 06-18-2004
syntax error thrown

I am unable to trace the syntax error reported.... can any one help?
Code:
#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...

Code tags added for readability --- Perderabo

Last edited by Perderabo; 06-18-2004 at 09:53 AM..
# 2  
Old 06-18-2004
Assume your script file is called assert9419

Code:
ksh -v ./assert9419

will display each line as it executes
# 3  
Old 06-19-2004
Thanks guys. for your effort into ....

It works like a dream with nawk

nawk -f 9419test.awk /omp-data/logs/aplogs/20040617.DBG


PAKKA....
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

IF section problem. syntax error: unexpected end of file error

Hello, I have another problem with my script. Please accept my apologies, but I am really nooby in sh scripts. I am writing it for first time. My script: returned=`tail -50 SapLogs.log | grep -i "Error"` echo $returned if ; then echo "There is no errors in the logs" fi And after... (10 Replies)
Discussion started by: jedzio
10 Replies

2. Linux

Ambiguous redirect error and syntax error when using on multiple files

Hi, I need help on following linux bash script. When I linux commands for loop or while loop on individual file it runs great. but now I want the script to run on N number of files so it gives me ambiguous redirect error on line 12 and syntax error on line 22 : (pls help ); #!/bin/bash #... (16 Replies)
Discussion started by: Madhusudan Das
16 Replies

3. UNIX for Dummies Questions & Answers

Thrown in position, need to manage AIX 5.3

Hey Everyone, First post and I'm coming here for help. Basically, the company I work for has been put in a weird situation with staff turnover. I used to manage an application on our IBM p5 running AIX 5.3, but I am now managing the whole server itself. I have no experience, no box to test... (1 Reply)
Discussion started by: pvpkife
1 Replies

4. Shell Programming and Scripting

Receiving error: ./ang.ksh[35]: 0403-057 Syntax error at line 116 : `done' is not expected.

Hi All I am quite new to Unix. Following is a shell script that i have written and getting the subject mentioned error. #!/bin/ksh #------------------------------------------------------------------------- # File: ang_stdnld.ksh # # Desc: UNIX shell script to extract Store information.... (3 Replies)
Discussion started by: amitsinha
3 Replies

5. Shell Programming and Scripting

background image not loading in newly thrown html page by shell script

I m trying to throw back html page when a file is found.While throwing back html page, the background image is not coming. I am using Apache server.Please suggest how to resolve... #!/bin/ksh echo -e "Content-type: text/html\n\n" echo "<html><head></head><body background=\"/asc/ppp.jpg\">"... (10 Replies)
Discussion started by: ravi18s
10 Replies

6. AIX

nim mksysb error :/usr/bin/savevg[33]: 1016,07: syntax error

-------------------------------------------------------------------------------- Hello, help me please. I am trying to create a mksysb bakup using nim. I am geting this error, how to correct it ? : Command : failed stdout: yes stderr: no... (9 Replies)
Discussion started by: astjen
9 Replies

7. AIX

Error thrown while trying to build in AIX 5.2

Hi All, Currently my project source code is compatible with HP-UX11.0 and Sun Solaris5.8. I m trying to build the source code in AIX 5.2 using gcc 4.2.2 compiler. Can anyone suggest me after seeing the rules file, what options do i need to specify to get rid of the cb error I m... (0 Replies)
Discussion started by: cleopatra789
0 Replies

8. UNIX for Dummies Questions & Answers

awk Shell Script error : "Syntax Error : `Split' unexpected

hi there i write one awk script file in shell programing the code is related to dd/mm/yy to month, day year format but i get an error please can anybody help me out in this problem ?????? i give my code here including error awk ` # date-month -- convert mm/dd/yy to month day,... (2 Replies)
Discussion started by: Herry
2 Replies

9. UNIX for Dummies Questions & Answers

Mouning a Jaz drive on a DEC Alpha? (with a little Solaris thrown in)

Hi, I'm a programmer with a bit of Linux experience who's found himself thrust into the world of out of date Unix versions and hardware. I could really use some help so I can get back to doing something productive with my work days! I have been tasked with getting some information off some Jaz... (1 Reply)
Discussion started by: Bartok
1 Replies
Login or Register to Ask a Question