jEdit Community - Resources for users of the jEdit Text Editor
Help! Poker playing jEdit noob needs urgent .txt file help
Submitted by ddess on Monday, 10 September, 2007 - 12:11
Hello All

I am a poker player. I use various tools to analyse my play. One of these tools relies on the importing of .txt files. However, the pokersite I use has recently changed the formatting of their so called Hand History .txt files and I can no longer import them into my hand analyses software. The chags to the .txt files are easy to see but finding a tool to make these changes in bulk correctly is proving somewhat of a challenge. A single poker hand looks like the one shown below and a session is a series of hands all stored in a single .txt file.

My ability to execute this is essential and I would be delighted to hear from anyone who could help set me on the right road. I'm sure with the right knowledge this will be fairly simple. Below are a couple of examples of the formatting changes that I need to make

I look forward to hearing from anybody who feels they can help.

1. First Line

Instead of - TEXAS_HOLDEM, , 309556744
I need it to read - Texas Hold'em $1-$2 NL (Real Money), #309556744

Where the '$1-$2' is information collected from the line beneath ANTES/BLINDS

2. 'FLOP' & 'TURN' Line

In this particular hand the information contained in the [ ] after the words FLOP and TURN is identical. I need to be able to identify this and where it is identical overwrite the TURN line with the text SHOWDOWN so :-

FLOP [board cards: 7H,5H,2D ]
Haemaelii bets $12, MaccaDrum folds.

TURN [board cards: 7H,5H,2D ]
Haemaelii wins $30.05.

becomes

FLOP [board cards: 7H,5H,2D ]
Haemaelii bets $12, MaccaDrum folds.

SHOWDOWN
Haemaelii wins $30.05.


____________

TEXAS_HOLDEM, , 309556744
played at "Bruckmur" for USD RM from 1969-12-31 18:59:59



Seat 1: masterF ($473.25 in chips)
Seat 2: Tekkie5 ($170.35 in chips)
Seat 3: Johnnie1970 ($236.90 in chips)
Seat 4: DJDomus ($32 in chips)
Seat 5: MaccaDrum ($181.55 in chips)
Seat 6: x..X..x ($139.65 in chips)
Seat 7: 123Arttu ($201.95 in chips)
Seat 8: Kukko8383 ($20 in chips)
Seat 9: ghttt11444 ($208 in chips)
Seat 10: Haemaelii ($293 in chips)



ANTES/BLINDS
123Arttu posts blind ($1), Kukko8383 posts blind ($2).

PRE-FLOP
ghttt11444 folds, Haemaelii bets $8, masterF folds, Tekkie5 folds, Johnnie1970 folds, DJDomus folds, MaccaDrum calls $8, x..X..x folds, 123Arttu folds, Kukko8383 folds.

FLOP [board cards: 7H,5H,2D ]
Haemaelii bets $12, MaccaDrum folds.

TURN [board cards: 7H,5H,2D ]
Haemaelii wins $30.05.



SUMMARY
Dealer: x..X..x
Pot: $31, (including rake: $0.95)
masterF, loses $0
Tekkie5, loses $0
Johnnie1970, loses $0
DJDomus, loses $0
MaccaDrum, loses $8
x..X..x, loses $0
123Arttu, loses $1
Kukko8383, loses $2
ghttt11444, loses $0
Haemaelii, bets $20, collects $30.05, net $10.05
_________________
Comment viewing options
Select your preferred way to display the comments and click 'Save settings' to activate your changes.
I can't tell whether this is
by LDiracDelta on Sat, 29/09/2007 - 18:51
I can't tell whether this is spam or not... but if you are trying to process text files, you'll want to do it in a scripting language. There are a bunch of different scripting languages, but it is my opinion that Python is the best.

It kinda sounds like you are cheating... but whatever. If you want to transform text from 1 format into another, you'll want to do that with python.

You'll have to download it
Windows : http://www.activestate.com/Products/activepython/index.plex
Linux -- ( you probably already have it, because you're an uber geek)
Mac OS X -- http://www.python.org/download/mac/


Then you'll have to learn to use Python's regular expression system: http://www.amk.ca/python/howto/regex/regex.html#SECTION000400000000000000000 And learn how to iterate over a file:
file = open("history_file.txt", 'r')

lines = file.readlines()

for line in lines:
    print 'before line'
    print line
    print 'after line'
I do this kind text transform at work all the time. I've written ~6000 lines of python code, so if you have any questions, email me:
User login
Browse archives
« April 2024  
MoTuWeThFrSaSu
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
 
Poll
Are you interested in language packs for jEdit?
Yes, and I could help maintain translations
26%
Yes, I'd like to have translations
32%
Indifferent
35%
No, that'd be bad (please comment)
7%
Total votes: 1093
Syndication
file   ver   dls
German Localization light   4.4.2.1   82348
Context Free Art (*.cfdg)   0.31   46055
JBuilder scheme   .001   18495
BBEdit scheme   1.0   18116
ColdFusion scheme   1.0   18024
R Edit Mode - extensive version   0.1   17473
Advanced HTML edit mode   1.0   16206
Matlab Edit Mode   1.0   16068
jEdit XP icons   1.0   15229
XP icons for jEdit   1.1   14293