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: 431
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 all the password field in text file with random chars? (62%)
How to replace the 2nd and 3rd occurrences of some words in multiple files? (61%)
How to replace words in a text file only if they are whole words? (58%)
How to replace one specified word with a sequence of words from a file? (57%)
How to count the occurrance of some specified words in many files? (57%)
How to sort the lines in a text files by the order of line length? (57%)
How to replace non-fixed text pattern in a html file? (57%)
How to replace some text like abc.html with real html file name for hundreds of html files? (57%)

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