Page 1 of 1

PAD out lines

Posted: Wed Sep 20, 2000 1:54 pm
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?)

RE: PAD out lines

Posted: Wed Sep 20, 2000 10:44 pm
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

RE: PAD out lines

Posted: Thu Sep 21, 2000 3:29 am
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 !)

; - )

RE: PAD out lines

Posted: Thu Sep 21, 2000 3:30 am
by Dave Rolph
Good job TextPad has a spell Checker !!

I meant to say TextPad ! <G>