How to print third column to last column?

前端 未结 19 2109
面向向阳花
面向向阳花 2020-11-28 18:44

I\'m trying to remove the first two columns (of which I\'m not interested in) from a DbgView log file. I can\'t seem to find an example that prints from column 3 onwards unt

19条回答
  •  伪装坚强ぢ
    2020-11-28 19:00

    Jonathan Feinberg's answer prints each field on a separate line. You could use printf to rebuild the record for output on the same line, but you can also just move the fields a jump to the left.

    awk '{for (i=1; i<=NF-2; i++) $i = $(i+2); NF-=2; print}' logfile
    

提交回复
热议问题