How to convert rows to columns in unix

前端 未结 5 1024
离开以前
离开以前 2021-01-03 12:50

I want my Unix file output, which has each value output on a new line, to be converted into grouped rows as shown below.

Say my output file in Unix looks like this:

5条回答
  •  悲&欢浪女
    2021-01-03 13:04

    This is a minimal awk solution:

    awk 'ORS=NR%4?" ":"\n"' input.txt 
    

    output

    jobname userid starttime endtime
    jobname2 userid starttime endtime
    

    (If you want to align the fields, pipe to column -t)

提交回复
热议问题