User: editor -- 2010-04-12 << 474 476 >> |
Hits: 4544 |
Type: Advanced search and replace |
Search all Advanced search and replace examples |
Description: |
How to replace a string in one text file with random words from another file? I have a text file address.txt that contains keywords _NAME_ , and I have another text file name.txt that contains real names. How to replace all the _NAME_ in address.txt with the real name from name.txt randomly? |
Input Sample: |
================ address.txt: ... _NAME_ .... .._NAME_ ...._NAME_.... ...... ================ name.txt Joanna Peter Tony Jack ... |
Output Sample: |
... Joanna .... ..Tony ....Peter.... ...... |
Answer: |
Hint: You need to Download and install "Replace Pioneer" on windows platform to finish following steps. |
1. Add the name.txt into dictionary (1) ctrl-o open name.txt (2) ctrl-h open replace window * set 'Replace Unit' to 'Line' * click 'Advanced' page, set 'run following at the beginning of replace' to: set 'run following for each replace unit' to: (3) click 'Replace', done! 2. Replace the file address.txt: (1) ctrl-o open address.txt (2) ctrl-h open 'replace' window in 'search for pattern' enter: in 'replace with pattern' enter: (3) click 'replace', done (4) ctrl-s save to disk. |
Download Script: scripts/475.rst.zip |
Screenshot 1: Replace_Window |
Screenshot 2: Replace_Advanced_Window |