Page 1 of 1

textpad: inserting a word every # of lines

Posted: Mon Dec 07, 2009 11:49 pm
by tonym
Hi,
Searched but could not locate this answer.
How can I insert a word every 15 lines in a file?

For example:
line 1
line 2
(..and so on)
line 14
line 15
>insert "word" here<
line 17
line 18
line 19

Thank you
Tony

Posted: Tue Dec 08, 2009 2:24 am
by Bob Hansen
Search for: ^.*\n.*\n.*\n.*\n.*\n.*\n.*\n.*\n.*\n.*\n.*\n.*\n.*\n.*\n.*\n
Replace with: \0new word\n

Replace All will not work, but Replace Next does work.

Use the following settings:
-----------------------------------------
[X] Regular expression
Replace Next
-----------------------------------------
Configure | Preferences | Editor
[X] Use POSIX regular expression syntax
-----------------------------------------

Posted: Tue Dec 08, 2009 11:11 pm
by tonym
Thank you Bob! I do appreciate the input and the quick response.
Cheers!
Tony