awk without printing newline

前端 未结 6 1389
失恋的感觉
失恋的感觉 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条回答
  •  Happy的楠姐
    2020-12-12 14:51

    You can simply use ORS dynamically like this:

    awk '{ORS="" ; print($1" "$2" "$3" "$4" "$5" "); ORS="\n"; print($6-=2*$6)}' file_in > file_out

提交回复
热议问题