Um caminho:
Conteúdo de infile
:
columnA columnXYZ columnBLAHBLAH
foo bar foobar
blah blahblah blahblahblah
Conteúdo de script.awk
:
FNR == 1 {
split( $0, header )
}
FNR > 1 {
printf "************ %d. row ************\n", FNR-1
for ( i = 1; i <= NF; i++ ) {
printf "%14s: %-14s\n", header[ i ], $i
}
}
Execute o script:
awk -f script.awk infile
E saída:
************ 1. row ************
columnA: foo
columnXYZ: bar
columnBLAHBLAH: foobar
************ 2. row ************
columnA: blah
columnXYZ: blahblah
columnBLAHBLAH: blahblahblah