Advertisement

Syntax error in awk programs

Started by July 03, 2006 05:25 AM
-1 comments, last by cucubird 18 years, 4 months ago
Hi, I am really having a hard time debugging awk programs as the error messages they give are so vague... I have tried writing a method in awk which allows the comparison of a source file with the DB gen_ListA() { awk ' NR==FNR{ split($0,db_rec,",") db_vara=db_rec[1] db_varb=db_rec[2] db_varc=db_rec[3] db_vard=db_rec[4] db_vare=db_rec[5] db_varf=db_rec[6] db_idx_str=(db_vara db_varb db_varc db_vard db_vare db_varf) gsub(/ /,"",db_idx_str) ######################syntax error db[FNR, db_idx_str]=$0 ######################syntax error next} { o_vara=substr($0,1,13) o_varb=substr($0,145,17) o_varc=substr($0,162,8) o_vard=substr($0,245,17) o_vare=substr($0,262,8) o_varf=substr($0,653,7) o_idx_str=(o_vara o_varb o_varc o_vard o_vare o_varf) gsub(/ /,"",o_idx_str)##############syntax error found=0 for(i in db) { split(i,dbidx,SUBSEP) if ( o_idx_str == dbidx[2] ) { found = 1 next } } if (found != 1 ) print }' $db_file $tmp_file > $list_A_file } However, I received errors at lines which i marked using # at the end...I got a syntax error and illegal statement there... Can someone please help and advise me on whats wrong with that syntax...Thanks a million...this is rather urgent for me... thanks a million

This topic is closed to new replies.

Advertisement