Replace Pioneer Home   All Examples   Free Download

 New request --free  RSS: Replace Pioneer Examples

475.Advanced search and replace -- How to replace a string in one text file with random words from another file?

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


Screenshot 3:  Replace_Window


Similar Examples:
How to replace some text with a random line from another file? (79%)
How to replace strings in one file with words from another file sequentially? (78%)
How to replace a string with one of the specified words randomly in multiple files? (71%)
How to replace the quoted text with lines from another file? (70%)
How to replace string in the Nth file with the Nth strings from a list? (62%)
How to fill in one xml file with elements from another xml file? (62%)
How to replace all the password field in text file with random chars? (62%)
How to replace strings in multiple text files with an increasing id start from 1? (61%)

Check Demo of Advanced search and replace
Keywords:
random words  keywords  dictionary  diction  keyword  toc  randomly  dic  another file  random word  search and replace random keywords  randomly replace words  random replace text string  string replace randomly  replace with random words  replace text with random words  replace text from one file to another  replace text from another file