Reputation: 1
I have a program which output is summary file with header and few columns of results. I want to show only two data: file name and best period prediction and I use this command:
program input_file | gawk 'NR==2 {print $3}; NR==4 {print $2}'
as the result I obtain result in one column, two lines. What I have to do to have this result in one line, two columns?
Upvotes: 0
Views: 23
Reputation: 754550
You could use:
program input_file | gawk 'NR==2 {heading = $3}; NR==4 {print heading " = " $2}'
This saves the value in $3
on line 2 in variable heading
and prints the heading and the value from column 2 when it reads line 4.
Upvotes: 1