PAD out lines

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
Dave Rolph

PAD out lines

Post by Dave Rolph »

Hi !

I am just evaluating TextPad it looks great!

One thing I am trying to do is pad out a so called fixed length export file.

I have a file that looks something like this .

XXXX XXX XXX XXX XXXX
XXXX XXX XXX XXX XX
XXXX XXX XXX XXX
XXXX XXX XXX X XXXX
XXXX XXX XXX XXXX

And I want to make all line equal - is there any way TextPad can do it ?

(I hope this comes out OK but if not I am sure you will get the idea?)
Andreas

RE: PAD out lines

Post by Andreas »

You could record a macro which does:
(if you want your lines to be 80 characters long, if your number is different, replace 80 with your number)

append 80 spaces to all lines
do a regular expression replace:
\(.\{80,80\}\).*
by
\1

(the search expression takes exactly eighty characters and remembers these for the replace, the replace expression just puts the first [and in this case the only] remembered string)

HTH
Andreas
Dave Rolph

RE: PAD out lines

Post by Dave Rolph »

Thats works a treat !

I was unsure at first how it worked but basically make sure the difference between the shortest line and the longest is added as spaces to all lines.

Then run the replace

Great ! - My order will be in the post next week (and I will recomend TextPas to all I meet !)

; - )
Dave Rolph

RE: PAD out lines

Post by Dave Rolph »

Good job TextPad has a spell Checker !!

I meant to say TextPad ! <G>
Post Reply