Replace Pioneer Home   All Examples   Free Download

 New request --free  RSS: Replace Pioneer Examples

1315.Random word generator -- How to keep specified number of lines randomly?

User: Aaron -- 2015-08-09          << 1314  1316 >>
Hits: 1537
Type: Random word generator   
Search all Random word generator examples
Description:
I would like to match the line counts of multiple text files to the same line count as a target file.

For example, File A has 1000 lines. This is the target line count.

Multiple files B, C, D, and E etc. are imported to batch runner. They all have different line counts: 1347, 1894, 2004 etc.

I would like to sequentially delete random lines from the source files and output new B,C, D, and E text files all with 1000 lines.

Sequential deletion of random lines means that the order of the output l
Input Sample:
For example:

Original File B:

Line 1
Line 2
Line 3
Line 4
Line 5
etc.  total of 1347 lines

Original File C:

Line 1
Line 2
Line 3
Line 4
Line 5
etc.  total of 1894 lines
Output Sample:
Output File B:

Line 2
Line 3
Line 5
etc.  until 1000 lines reached

Output File C:

Line 1
Line 2
Line 4
etc.  until 1000 lines reached

Script 964 does something similar by entering a value for the number of lines to be extracted but the output file lines are in random order instead of sequential.
Answer:
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 files to "batch runner" window.
3. set "change output folder" to a newfolder, so that original files will not be overwritten
4. click "Fast Replace" button
* click "add" to add new rule
* keep "search" to be blank
* set "replace" to:

* click "ok"
5. click "start", done.

Note: for single file, you can also use ctrl-h open 'replace' widnow, and set 'replace with pattern' to what in step4, and click 'replace'.

Screenshot 1:  Fast_Replace_Window


Similar Examples:
How to re-arrange lines with in a specified number of lines? (67%)
How to sort all the numbers in each line randomly? (65%)
How to merge all files, and split into specified number of files evenly? (63%)
How to distribute 6 numbers into multiple lines randomly? (61%)
How to make specified change for .htaccess file? (60%)
How to replace letters with predefined numbers in a text range? (59%)
How to change the location of all numbers randomly? (59%)
How to change specified number to increasing numbers that are multiple of 6? (58%)

Check Demo of Random word generator
Keywords:
sequential  ray  array  written  what  random lines  200  unique  randomly  random word generator  batch file number generator  sort random lines text  random sort in word  random sort batch  batch file number of word count  batch split file line count  random sort of lines in text file  word sort generator