Replace Pioneer Home   All Examples   Free Download

 New request --free  RSS: Replace Pioneer Examples

1125.Text merge -- How to create a text file by choosing N random lines from each of many files?

User: Aaron Allan -- 2013-09-04          << 1124  1126 >>
Hits: 2176
Type: Text merge   
Search all Text merge examples
How to create a text file by choosing one random line from a set of files in sequence? For example, choose random line from Text1.txt, followed by random line from Text2.txt, then Text3.txt etc. The number of lines for output can be set. In this example we'll use 12 files and output 12 lines according to the example below.
Input Sample:
-CONTENT OF Text1.txt : 

Text1 -Line1. 
Text1 -Line2. 
Text1 -Line3. 
Text1 -Line4. 

-CONTENT OF Text2.txt : 

Text2 -Line1. 
Text2 -Line2. 
Text2 -Line3. 
Text2 -Line4. 

-CONTENT OF Text3.txt : 

Text3 -Line1. 
Text3 -Line2. 
Text3 -Line3. 
Text3 -Line4. 

-CONTENT OF Text12.txt : 

Text12 -Line1. 
Text12 -Line2. 
Text12 -Line3. 
Text12 -Line4. 
Output Sample:
Text1 -Line3. 
Text2 -Line27. 
Text3 -Line300. 
Text4 -Line57. 
Text5 -Line89. 
Text6 -Line6. 
Text7 -Line17. 
Text8 -Line48. 
Text9 -Line6.
Hint: You need to Download and install "Replace Pioneer" on windows platform to finish following steps.
1. open "Tools->Batch Runner" menu
2. drag multiple text files from "windows file browser" to "batch runner" window
3. click "Fast Replace" button to open "Fast Replace" dialogue
4. click "add" to add new rules:
* keep 'search' to be blank
* set 'replace' to: 
Note: in this case we choose 3 lines, you can change it to other values accordingly.
* click "ok"
5. click "start", and click "output to single file" button, then select an output file, done.

Screenshot 1:  Fast_Replace_Window

Similar Examples:
How to replace some text with a random line from another file? (65%)
How to batch rename text files with random line from file contents? (65%)
How to merge 3 text files by getting one line from each file repeatly? (64%)
How to remove leading and trailing blanks in each line in many files? (63%)
How to duplicate a line and change midi to mp3 in many files? (61%)
How to remove the trailing blank lines in the end of file? (60%)
How to sort a text file by the length of text in each line? (60%)
How to replace a string in one text file with random words from another file? (60%)

Check Demo of Text merge
random lines  create a text  unique  create  random line  text merge  merge  merg  mer  output to single file  batch create random text  batch create line from many lines  add sequence number to lines in a text file  create many files sequence number  replace text file according rules  add sequence number to each line batch  batch random example  batch file random number sequence