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:
jobname
userid
starttime
endtime
jobname2
userid
starttime
endtime
I want the output to be:
jobname1 userid starttime endtime
jobname2 userid starttime endtime
With GNU sed:
This is a minimal
awk
solution:output
(If you want to align the fields, pipe to
column -t
)This will paste each four consecutive lines as four tab-delimited fields:
If you are looking for a shell script, you can do this as the number of lines to be printed in the output seems to have to fixed length:
Kind of ugly, but doesn't require a shell script: