Replace Pioneer Home   All Examples   Free Download

 New request --free  RSS: Replace Pioneer Examples

1152.Advanced search and replace -- How to randomly insert a word or phrase x number of times into text files?

User: Aaron -- 2013-12-04          << 1151  1153 >>
Hits: 3036
Type: Advanced search and replace   
Search all Advanced search and replace examples
Description:
I would like to randomly insert a word or phrase x number of times into text files. The word or phrase would be randomly inserted as new lines.
Input Sample:
Text file 1. 
 
Line 1 text text text etc. 
Line 2 text text text  text etc. 
Line 3 etc. 
Line 4 etc. 
 
Text file 2. 
 
Line 1 text text text etc. 
Line 2 text text text  text etc. 
Line 3 etc. 
Etc. 
 
Randomly insert the phrase (ABC) twice  
into each file as new lines.
Output Sample:
Text file 1. 
 
Line 1 text text text etc. 
(ABC) 
Line 2 text text text text etc. 
Line 3 etc. 
(ABC)  
Line 4 etc. 
 
Text file 2. 
 
(ABC)  
Line 1 text text text etc. 
Line 2 text text text text etc. 
Line 3 etc.  
(ABC) 
Etc.
Answer:
Hint: You need to Download and install "Replace Pioneer" on windows platform to finish following steps.
1. ctrl-o open text file 
2. ctrl-h open 'replace' dialogue 
* set 'replace with pattern' to: 
 
* click 'advanced' tab, set 'run following for each matched unit' to: 
 
3. click 'replace', done. 
4. ctrl-s save to file.

Screenshot 1:  Replace_Window


Screenshot 2:  Replace_Advanced_Window


Similar Examples:
How to Random insert one or three line to a text file? (70%)
How to randomly deletes x number of lines from text files? (69%)
How to insert a word or phrase to the begining of each line? (64%)
How to insert a keyword only at first line of multiple text files? (61%)
How to translate the hex number to decimal number inside a text file? (61%)
How to randomly delete x number of lines from text inside and outside brackets? (60%)
How to extract all lines with numbers from many text files? (59%)
How to replace a word only one time in multiple text files? (58%)

Check Demo of Advanced search and replace
Keywords:
x01  phrase  randomly  abc  times  random  rando  rand  time  count  insert randomly  file with phrase  count number of lines  insert lines to each file  replace phrase  replace a phrase  insert 2 lines  replace word randomly