As title says, what is the syntax of Ternary in awk command in order to write to a file when condition is seen?Below I'm trying but getting syntax error for given inputs!Input sample data infile.txt:1,1,c0,3,b0,0,a1,5,z1,5,y5,5,xThe command:awk -F',' '{print (($1==$2)?>success.txt: >failed.txt)}' infile.txtawk: {print (($1==$2)?>success.txt: >failed.txt)}awk:                  ^ syntax errorawk: {print (($1==$2)?>success.txt: >failed.txt)}awk:                                                ^ syntax errorI can use if/else, but want to know the same with Ternary syntax possibility and maybe where am I using redirection > wrong?awk -F',' '{if ($1==$2) print >success.txt;else print >failed.txt}' infile.txt
How do I use Ternary Operator within awk to write to a file?
awk
Make the ternary operator choose only the file, not the redirection:awk -F',' '{print >(($1==$2)?success.txt: failed.txt)}'