[TxMt] Ebook Editing

Peter Cowan cowan.pd at gmail.com
Mon Jan 28 07:01:46 UTC 2008


You'll probably get a better answer, but it seems that a regular
expression search would work.  They are detailed in chapter 20 of the
Textmate help.

Based on the posted example the following should work.

Open the find window (command + F)
Set the find to the following (no extra spaces):
\n[0-9]{1,3}.+\n

Set replace to nothing

Be sure "Regular Expression" is checked.  You can see if it's
highlighting the right part by clicking next, before replacing all.

I'll break it down for you:

\n -- match the new line before the number

[0-9]{1,3} -- match a number that is 1 to 3 digits long, if your book
has more pages than that you'll need to change this.  This also won't
work for pages with roman numerals

.+ -- match one or more of any character until the end of the line,
this gets the spaces and author name.

\n -- match the newline after the above match.

Check out the tutorial linked from the Textmate help, Regular
Expressions are very handy.

Peter






On Jan 27, 2008 8:44 PM, Gideony <gideon.addington at gmail.com> wrote:
>
> Recently I got an eBook reader so I've been trying to scan in some of my
> books instead of buying them again.
>
> I've got the process down pretty well (thanks to a a OpticBook 3600) but I'm
> having trouble doing some fine editing.
>
> As you can imagine, the text can get pretty big so I need automated
> processes to make this efficient.
>
> I've been using text mate do do a lot of this - unwrapping text and such,
> but I need to remove the page numbers/titles.
>
> So, with this text:
>
>
> Ser Waymar Royce glanced at the sky with disinterest. "It does that every
> day
> about this time. Are you unmanned by the dark, Gared?"
> Will could see the tightness around Gared's mouth, the barely sup
> 2  GEORGE R.R. MARTIN
> pressed anger in his eyes under the thick black hood of his cloak. Gared had
> spent forty years in the Night's Watch, man and boy, and he was not
> accustomed
> to being made light of. Yet it was more than that. Under the wounded pride,
> Will could sense something else in the older man. Yonervous tension that
> came perilous close to fear.
>
> ---
> I need to figure out a way to remove the page numbers and the break that
> will be a number then the author/title.  And then I'd need to be able to
> reflow it like the rest of the text without a big space there.
>
> Any help would be greatly appreciated.
> (It stands to mention that I really can't write applescript or anything
> along those lines.  I need an "inside textmate" solution, or other program I
> may have.)
>
> --
> View this message in context: http://www.nabble.com/Ebook-Editing-tp15127738p15127738.html
> Sent from the textmate users mailing list archive at Nabble.com.
>
>
> ______________________________________________________________________
> For new threads USE THIS: textmate at lists.macromates.com
> (threading gets destroyed and the universe will collapse if you don't)
> http://lists.macromates.com/mailman/listinfo/textmate
>



More information about the textmate mailing list