On 17-Feb-99 [EMAIL PROTECTED] wrote:
> Hi,
>
> I have a large file with many rows and columns. For some application to make
> use of this file, i need to change rows to columns and vice versa. How do i
> achieve this?
There are more than one way to acheive what you need. I don't think that there
are any programs that specifically acheive what you need, but it is relatively
simple to use some standard tools to accomplish your objective.
Here's one approach using a simple awk script.
awk '
BEGIN {
Row=1
}
{
NumberOfCol=NF
for (Col=1; Col<=NumberOfCol; Col++) {
FileData[Row,Col]=$Col
}
Row++
next
}
END {
NumberOfRow=Row
for (Col=1; Col<=NumberOfCol; Col++) {
for (Row=1; Row<=NumberOfRow; Row++) {
printf(FileData[Row,Col] " ")
}
printf("\n")
}
}
'
Cort
[EMAIL PROTECTED]