16
9
How do I add
Keyboard : E : KeyDown
DELAY : 1300
Keyboard : E : KeyUp
DELAY : 200
to every X line in a text document?
16
9
How do I add
Keyboard : E : KeyDown
DELAY : 1300
Keyboard : E : KeyUp
DELAY : 200
to every X line in a text document?
24
To insert a new line after every 9 rows, go to Search
> Replace
menu (shortcut CTRL+H) and do the following:
Find what:
(.*\r?\n){9}\K
Replace:
Your new line\n
Select radio button "Regular Expression"
Then press Replace All
You can test it at regex101.
1This worked for me. But don't forget to uncheck the [x] ". as linebreaks" checkbox for regular search. – patrics – 2016-01-07T20:21:43.447
Worked great, thanks! Note, if your new line has any special regex characters like \
or *
, you'll need to escape them with a backslash. \\
or \*
. – twasbrillig – 2017-01-09T21:37:09.420
Apperently \K is a little bug for replacing. In my case I needed to use capture groups similar to the other answer instead of using \K. – AaronLS – 2018-02-01T21:40:31.543
3
Still using search/replace, this worked better in my case: selects [your example 9 lines] in one group (the inner '()' pair for each line followed by 'newline'), then the '{}' pair for the look-ahead line count to grab, and the outer '()' pair for the 9 lines retained as a group
((.*\n){9})
Use the \1 variable to restore the same [9] line group, followed by [your sample line insert] and a newline
\1\nKeyboard : E : KeyDown DELAY : 1300 Keyboard : E : KeyUp DELAY : 200\n
Please read the question again carefully. Your answer does not answer the original question. – DavidPostill – 2016-08-31T07:20:08.623
Tweaked to match OP syntax – netify – 2016-10-19T18:39:25.670
0
I'm note sure if it works in Notepad++, but this is how I solved it with PSPads phReplace:
Search:
(.*\r\n.*\r\n.*\r\n.*\r\n.*\r\n.*\r\n.*\r\n.*\r\n)
Replace:
$1New Line[Enter]
[Enter]
stands for pressing the Enter-Button as phReplace does not allow \r\n
in replace field.
How is this better than @psxls answer? – Toto – 2019-08-11T16:35:14.947
@Toto His answer did not work for me. – mgutt – 2019-08-11T20:27:39.463
It is strictly the same but condensed – Toto – 2019-08-11T20:53:12.953
FYI you can do it online as well http://textmechanic.com/text-tools/basic-text-tools/addremove-line-breaks/
– Franck Dernoncourt – 2016-03-14T19:57:11.4701You can simply do it with a programming language like C or Java. – Ali Hashemi – 2013-11-25T16:01:24.853
Can you be a little more specific about what your file already contains and what you'd like it to be replaced with? This can probably be done using the find/replace regular expressions feature of Notepad++, but I'd have to get a clearer example (similar to the example here) to provide a solution.
– allquixotic – 2013-11-25T16:25:16.373