How do I detect embbeded field names and reorder fields using awk?
问题 I have the following data: "b":1.14105,"a":1.14106,"x":48,"t":1594771200000 "a":1.141,"b":1.14099,"x":48,"t":1594771206000 ... I am trying to display data in a given order and only for three fields. As the fields order is not guaranteed, I need to read the "tag" for each comma separated column for each line. I have tried to solve this task using awk : awk -F',' ' { for(i=1; i<=$NF; i++) { if(index($i,"\"a\":")!=0) a=$i; if(index($i,"\"b\":")!=0) b=$i; if(index($i,"\"t\":")!=0) t=$i; } printf(