Add a line
-
I want to add a line after a specific line multiple times in a block of code. For example: I want to add “The color Red” after " The color Blue" where “The color Blue” line is in the block a hundred times.
-
@cjb said in Add a line:
I want to add a line after a specific line multiple times in a block of code
I find the question ambiguous.
Do you want to find a specific line which exists multiple times throughout a file, then add a single line after each instance? And the might be a hundred of the instances.
OR
Do you want to add a specific line 100 times after each time another line exists?Terry
-
@cjb ,
Use regular expression searching. Specifically,
- FIND =
The color Blue(\R)\K
(\R)
will match your line ending and put it in group#1- the
\K
will reset the match “cursor” so that the replacement will go after the newline
- REPLACE =
The color Red${1}
- the
${1}
will put the contents of group#1 (your newline sequence) at the end of the new text
- the
- SEARCH MODE = Regular Expression
- REPLACE ALL
- cannot do one replacement at a time because of the
\K
- cannot do one replacement at a time because of the
----
Useful References
- FIND =
-
This post is deleted! -
@peterjones Perfect, thank you! Saved me sooo much time.