in reply to Re^4: Split tab-separated file into separate files, based on column name (open on demand)
in thread Split tab-separated file into separate files, based on column name
And if you know Perl, well it's not very difficult to decipher this Awk script ...
( ... oh that's were Larry got these "ideas" from ;-)
My concern is that it's neither easier nor shorter than Perl.
For comparison here a script version of my one-liner - already w/o taking advantages of command-line switches.
$\="\n"; while (<DATA>) { @F = split; unless (@FH) { open $FH[@FH], ">", "$_.txt" for @F; } else { print $_ shift @F for @FH; } } __DATA__ id name position 1 Nick boss 2 George CEO 3 Christina CTO
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: Split tab-separated file into separate files, based on column name (open on demand)
by haukex (Archbishop) on Aug 28, 2020 at 13:56 UTC |