Q: setting more variables insite awk if ? : I get error in such simple test with two variables:
$ echo test|awk '{$2 != ""? o="ABC" r="123" : o="123 r="ABC"}END{print "o:"o" r:"r}'
awk: cmd. line:1: {$2 != ""? o="ABC" r="123" : o="123 r="ABC"}END{print "o:"o" r:"r}
awk: cmd. line:1:                     ^ syntax error
awk: cmd. line:1: {$2 != ""? o="ABC" r="123" : o="123 r="ABC"}END{print "o:"o" r:"r}
awk: cmd. line:1:                                                         ^ syntax error
awk: cmd. line:1: {$2 != ""? o="ABC" r="123" : o="123 r="ABC"}END{print "o:"o" r:"r}
awk: cmd. line:1:                                                                ^ unterminated string
$

with single variables it works fine:
$ echo test|awk '{$1 != ""? o="ABC" : o="123"}END{print "o:"o}'
o:ABC
$ echo test|awk '{$2 != ""? o="ABC" : o="123"}END{print "o:"o}'
o:123


A: You can't really do that with the ? : operator, since it can handle a single value only, and two assignments would generate two values.
Use an actual if statement instead:
$ echo test|awk '{ if ($2 != "") { o="ABC"; r="123" } else { o="123"; r="ABC" }} END{ print "o:"o" r:"r}'
o:123 r:ABC

