Hello, i have a file as below:
...
AAA: 1
BBB: 2
CCC: 3
AAA: 11
BBB: 22
CCC: 33
AAA: 111
BBB: 222
CCC: 333
....
how to process it by using AWK to this:
(AAA BBB CCC)
....
1 11 111
2 22 222
3 33 333
....
thank in advance for your help.
Looks like all you want is to convert columns into rows, right? So if your file is named row.data, try this.
awk '{
arr[$1]=arr[$1]" "$2
}
END {
for ( i in arr) {
print i,arr
}
}
' row.data
The output is reversed, but I guess that should be fine, right?
It worked perfectly. Thank linuxpenguin.