awk without printing newline

前端 未结 6 1399
失恋的感觉
失恋的感觉 2020-12-12 14:24

I want the variable sum/NR to be printed side-by-side in each iteration. How do we avoid awk from printing newline in each iteration ? In my code a newline is printed by def

6条回答
  •  醉话见心
    2020-12-12 14:31

    awk '{sum+=$3}; END {printf "%f",sum/NR}' ${file}_${f}_v1.xls >> to-plot-p.xls

    print will insert a newline by default. You dont want that to happen, hence use printf instead.

提交回复
热议问题