[ QUOTE ]
Perl:
1. Rip through file, parsing out player names into an associative array
2. Join the array with commas
[/ QUOTE ]
Assuming you have Perl, save this as list_from_row.pl
<font class="small">Code:</font><hr /><pre>
#!/usr/bin/perl
# usage: list_from_row.pl [[filename]...]
my $MAX_LENGTH = 100;
my $OUTPUT_FILE = "fishFrySearch.txt";
my %fish;
open OUT, ">$OUTPUT_FILE" ||
die "Could not open output file $OUTPUT_FILE for writing.\n";
foreach my $file (@ARGV) {
my $count=0;
if (! -f $file) {
print "$file is not a file.\n";
} else {
open IN, $file || die "Could not open $file";
while (my $name = <IN>
{
$count++;
$name =~ s/^\s*//;
$name =~ s/\s*$//;
$fish{$name}++ if ($name);
}
}
print "Processed $count lines from $file.\n",
scalar(keys %fish)," unique names total.\n";
}
my $line='';
foreach my $name (sort keys %fish) {
if (length($line) + length($name) >= $MAX_LENGTH) {
printLine($line);
} else {
$line .= $name . ',';
}
}
printLine($line);
sub printLine() {
my $line = shift @_;
$line =~ s/,$//;
print OUT $line, "\n";
}
</pre><hr />