Trimming Text With Macros
I am having a bet!, it is one of my few vices, and it shall be on the horses. I don’t often have a bet and in fact I generally only ever have a bet on a special occasion, like the grand national or a random parallel bet with my dad.
number form horsename
SportingLife looks like a good one (top of my startpage search). The data though of course is in the wrong order and there is a lot of it for each horse.
My first thought with all these things is how can emacs help me out with this? Well a paste into the scratch buffer gives me something like this:
1 (5) Horse silk Saratoga Goldb27 Age: 4| Weight: 10-2| J: Owen Lewis(5)| T: C Hills| OR: 85| CD 15/8 Has taken his form up a notch Form: 556811|Timeform 2 (6) Horse silk Sword Beachb24 Age: 5| Weight: 9-13| J: George Bass| T: A King| OR: 82 28/1 Dual Windsor scorer in 2021 Form: 71165-0|Timeform
I think the best way to approach this is to open a new window along side the scratch buffer and use this as my formatted output window, I will just create a random blank new file for now called tmp.txt
Then using a macro I can search around extracting each piece of relevant data for each horse and then just copy to the right hand pane.
Once I have a procedure that works for a single horse then I can just end the macro and then
C-x e repeat the last keyboard macro and then spam
e until all the horses are parsed.
At which point I can copy the text from tmp.txt, paste into the html text input and press Find Winner, lets see if my old algorithm still holds up!