Hi All,
I have some data (below) that I need to rotate 90 degrees - in other words I want to flip each row into a column.
I've found the following code in the book "Effective awk programming" but it doesn't work on my input data. I've used arrays before but I can't make it work... can anyone help me out with this one?
awk '{
if (max_nf < NF)
max_nf NF
max_nr = NR
for (x = 1; x <= NF; x++)
vector[x, NR] = $x
} END {
for (x = 1; x <= max_nf; x++) {
for (y = max_nr; y >= 1; --y)
printf("%s ", vector[x, y])
print("\n")
}
}' $1
Thanks in advance
BTW: I've actually removed a text field from $1 (column 1) because I thought it would make it easier to solve - does this make any difference?
Cheers, p.