You should have many lines. Are you sure the second line is repeated enough to put these entries in a separate file? Anyway, awk keeps files open until the end. You will need a process that can close file descriptors when not in use.
Pearl for salvation. Yet again.
#!perl while( <> ) { @content = split /,/, $_; open ( OUT, ">> $content[1]") or die "whoops: $!"; print OUT $_; close OUT; }
usage: script.pl your_monster_file.csv
prints the entire line to a file with the same name as the value of the second CSV column in the current directory if no fields are specified, etc.
PaulProgrammer
source share