Two Plus Two Older Archives  

Go Back   Two Plus Two Older Archives > Internet Gambling > Software
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 07-22-2005, 02:15 PM
Rudbaeck Rudbaeck is offline
Senior Member
 
Join Date: Jul 2004
Location: Sweden
Posts: 555
Default Regexp Guru wanted

I have a text file consisting of a single column of player names.

I want this to turn into a series of rows, none of which is over 100 characters in length, with the player names comma deliminated and all duplicate player names removed.

Or for a high level view, if you can think of another way to do it: I want to take the export of all fish names from PT and make it into a bunch of strings that I can copy and paste into the Party Search function. [img]/images/graemlins/smile.gif[/img]
Reply With Quote
  #2  
Old 07-22-2005, 03:34 PM
tlnini tlnini is offline
Junior Member
 
Join Date: Sep 2004
Posts: 12
Default Re: Regexp Guru wanted

Perl script with 5-6 lines, or just open it up in Excel, and copy/paste using transpose, and save it as CSV
Reply With Quote
  #3  
Old 07-22-2005, 05:43 PM
Rudbaeck Rudbaeck is offline
Senior Member
 
Join Date: Jul 2004
Location: Sweden
Posts: 555
Default Re: Regexp Guru wanted

[ QUOTE ]
Perl script with 5-6 lines, or just open it up in Excel, and copy/paste using transpose, and save it as CSV

[/ QUOTE ]

Using excel is how I have been doing it. But as the datamining continues the fish list is growing rather long. There is essentially no way around copying and pasting the finished search strings into Party manually, so I wanted to cut down on the rest of the work as much as possible.
Reply With Quote
  #4  
Old 07-22-2005, 08:58 PM
Dr. Neau Dr. Neau is offline
Junior Member
 
Join Date: Jan 2005
Posts: 2
Default Re: Regexp Guru wanted

Perl:

1. Rip through file, parsing out player names into an associative array
2. Join the array with commas
Reply With Quote
  #5  
Old 07-22-2005, 10:23 PM
awr000 awr000 is offline
Junior Member
 
Join Date: Feb 2005
Posts: 16
Default Re: Regexp Guru wanted

myFish

It is by no means feature complete but should be functional enough to get started. I'll try and finish/augment it sometime over the next few days.
Reply With Quote
  #6  
Old 07-23-2005, 04:08 PM
StevieG StevieG is offline
Senior Member
 
Join Date: Jan 2003
Location: Baltimore, MD, USA
Posts: 157
Default Re: Regexp Guru wanted

[ 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, "&gt;$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 = &lt;IN&gt {
$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) &gt;= $MAX_LENGTH) {
printLine($line);
} else {
$line .= $name . ',';
}
}
printLine($line);

sub printLine() {
my $line = shift @_;
$line =~ s/,$//;
print OUT $line, "\n";
}

</pre><hr />
Reply With Quote
  #7  
Old 07-23-2005, 10:16 PM
Rudbaeck Rudbaeck is offline
Senior Member
 
Join Date: Jul 2004
Location: Sweden
Posts: 555
Default Re: Regexp Guru wanted

Awesome! Thank you so much.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 12:29 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.