0

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?

4

1 回答 1

1

你可以使用:

program input_file | gawk 'NR==2 {heading = $3}; NR==4 {print heading " = " $2}'

这会将第$32 行的值保存在变量heading中,并在读取第 4 行时打印第 2 列的标题和值。

于 2013-08-17T02:37:37.647 回答