You could write a short perl script (or even a one-liner) that would read the inverted input file and re-invert it to stdout. You can then use this to read and convert the file and read it's output directly using a piped open (See perlopentut)
The following example processes a simple whitespace delimited file and inverts it. You'll need to adapt flip.pl to your formats. Also, it assumes that every line will have the same number of columns as the first.
Note: The one-liner manually wrapped and uses win32 quoting.P:\test>type test.dat 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 P:\test>type flip.pl #! perl -slw use strict; my @cols; push @cols, [ split ] while $_ = <>; for my $n ( 0 .. $#{ $cols[ 0 ] } ) { print join ' ', map{ $_->[ $n ] } @cols; } P:\test>perl -le " open F, qq[ flip test.dat |]; print join '|', split while $_ = <F>; " 1|1|1|1|1|1|1|1 2|2|2|2|2|2|2|2 3|3|3|3|3|3|3|3 4|4|4|4|4|4|4|4 5|5|5|5|5|5|5|5
In reply to Re: reading columns from a flat file
by BrowserUk
in thread reading columns from a flat file
by nosbod
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |