awk what is wrong with my syntax? -


awk 'if(nf==7){print$1":"$2":"$4":"$5, $7, $6}else {print$1":"$2":"$3":"$4, $6, $5}' awk: if(nf==7){print$1":"$2":"$4":"$5, $7, $6}else {print$1":"$2":"$3":"$4, $6, $5} awk: ^ syntax error 

what syntax error here? arrow points if

rewrite code as:

awk '{print $1":"$2":" (nf==7 ? $4":"$5, $7, $6 : $3":"$4, $6, $5)}' 

and start reading effective awk programming, 4th edition, arnold robbins.


Comments