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
In reply to Re^5: Split tab-separated file into separate files, based on column name (open on demand)
by LanX
in thread Split tab-separated file into separate files, based on column name
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |