While I am conding some awk
script below, but it generates many unwanted LF
s. I wonder how to suppress (control) the output of LF
in this script. Thanks in advance for your kind advice.
awk '
BEGIN{
FS=OFS=","
}
{
nf=NF
s=0 # initialization
if($1==3){print "1,"; s+=50}else{print "0,"}
if($2==1){print "1,"; s+=50}else{print "0,"}
print s
print ","
}END{}' file
The content of the file (file) is something like,
3,1
3,2
In this case, the output is like
1,
1,
100
,
1,
0,
50
,
That is very clumsy. My desired output is like,
1,1,100
1,0,50