Replace Pioneer Home   All Examples   Free Download

 New request --free  RSS: Replace Pioneer Examples

443.Advanced search and replace -- How to insert a line after specific lines in a text file?

User: editor -- 2010-03-10          << 442  444 >>
Hits: 571
Type: Advanced search and replace   
Search all Advanced search and replace examples
Description:
How to insert a line after specific lines in a text file?

I have a text file containing some lines, I need to insert a line target=xxx after each line of source=xxx, how to do it automatically?
Input Sample:
replace=1
source=200
test=8000
....

source=260
test=999
Output Sample:
replace=1
source=200
target=200
test=8000
....

source=260
target=260
test=999
Answer:
Hint: You need to Download and install "Replace Pioneer" on windows platform to finish following steps.
1. ctrl-o open source text file
2. ctrl-h open replace window
* set 'replace unit' to line
* in search for pattern, enter:

* in replace with pattern, enter:

3. click 'replace', done!

Note: this example require Replace Pioneer version 2.52 and above. You need to change steps if use 2.51 or earlier.
Download Script:  scripts/443.rst.zip

Screenshot 1:  Replace_Window


Similar Examples:
How to insert a blank line after every 5 lines in a text file? (81%)
How to batch extract specified lines from a text file? (70%)
How to add a blank line after every 8 lines in text file? (70%)
How to extract all lines with specified date range from text file? (69%)
How to remove all lines that contain some specific strings in a text file? (68%)
How to sort and delete duplicate lines of a text file? (68%)
How to delete duplicate lines of a text file? (68%)
How to change the number in each line to specified order in a text file? (67%)

Check Demo of Advanced search and replace
Keywords:
after each line  specific line  specific  automatically  automatic  automat  auto  after  containing  ical  insert line after text  insert after  this after  example of line pattern  replace with specific  lines containing  insert line  line insert