Replace Pioneer Home   All Examples   Free Download

 New request --free  RSS: Replace Pioneer Examples

1162.Advanced search and replace -- How to replace everything outside brackets with lines from another file?

User: Aaron -- 2013-12-24          << 1161  1163 >>
Hits: 1159
Type: Advanced search and replace   
Search all Advanced search and replace examples
Thank you very much for script 1161 and 1160. I've been trying to modify them using search pattern [^\(\)]+(\(|$) to replace text outside brackets with text lines from another file. I want to keep the format of the input file but the output file loses all formatting.
Input Sample:
Original Text file: (Need to keep same format)

(text inside)
(more text inside)
Original Text Outside 1 (text inside again)
(more text inside) Original Text Outside 2
Original Text Outside 3

Replacement Text file:

Replace Text Outside 1
Replace Text Outside 2
Replace Text Outside 3
Output Sample:
Output: (need to keep same format as original)

(text inside)
(more text inside)
Replace Text Outside 1 (text inside again)
(more text inside) Replace Text Outside 2
Replace Text Outside 3
Hint: You need to Download and install "Replace Pioneer" on windows platform to finish following steps.
Assume the replacement text file is d:\test\2.txt 
1. ctrl-o open the source text file
2. ctrl-h open 'replace' dialogue
* set 'search for pattern' to:

* set 'replace with pattern' to:

3. click 'replace', done.
4. ctrl-s save to file.

Screenshot 1:  Replace_Window

Similar Examples:
How to replace the quoted text with lines from another file? (68%)
How to replace some text with a random line from another file? (65%)
How to replace each line with line have same start word from another file? (62%)
How to replace a string in one text file with random words from another file? (62%)
How to replace every 3 instances found in a text file? (61%)
How to remove everything after the first comma in each line in a text file? (60%)
How to reverse the order of all the lines in a text file? (60%)
How to remove everything after specified strings in text files? (59%)

Check Demo of Advanced search and replace
brackets  bracket  replacement  another file  script  scrip  scr  keep  test  how to replace every  ctrl h replace brackets  replace text from another file  text replacement  keep lines  replace another  save lines from text file  replace script  txt txt test