Replace Pioneer Home   All Examples   Free Download

 New request --free  RSS: Replace Pioneer Examples

933.Random word generator -- How to replace or remove 3 lines randomly in a text file?

User: editor -- 2012-03-30          << 932  934 >>
Hits: 2204
Type: Random word generator   
Search all Random word generator examples
Description:
How to replace or remove 3 lines randomly in a text file?
Input Sample:
line1
line2
line3
line4
line5
line6
line7
line8
line9
line10
Output Sample:
line1
This line is replaced
line3
This line is replaced
line5
line6
line7
line8
line9
This line is replaced
Answer:
Hint: You need to Download and install "Replace Pioneer" on windows platform to finish following steps.
To replace/remove any 3 lines in a text file:
1. ctrl-o open source text file
2. ctrl-h open 'replace' dialog
* set 'replace unit' to 'Line'
* set 'replace with pattern' to the new content such as:

if you want to remove the line, you should set 'replace with pattern' entry to be blank.
* set 'If=>' to:

* click 'advanced' tab:
* set 'run following at the beginning of replace' to:

3. click 'replace', done.
4. ctrl-s save to file

Explanation:
* rand_str_unique(-3,1..count(page(),'[^\n]+')) will generate 3 random numbers between 1 and total number of line, separated by new line, and store it in $A, such as:
3
5
6
* if $line_no appeared in $A ($A=~/\b$line_no\b/), this line will be replaced.

Screenshot 1:  Replace_Window


Screenshot 2:  Replace_Advanced_Window


Similar Examples:
How to replace every 3 instances found in a text file? (76%)
How to random remove x lines from a line range in text file? (72%)
How to remove around 1/2 lines randomly from a large text files? (72%)
How to replace the quoted text with lines from another file? (69%)
How to replace some text with a random line from another file? (68%)
How to change the word "good" to one of its synonyms randomly in a text file? (67%)
How to replace the second character of every line to 4 in a text file? (67%)
How to remove duplicate lines from a text file? (65%)

Check Demo of Random word generator
Keywords:
random number  total  unique  randomly  random word generator  random word gen  word generator  ord generator  separate  random word  random word generator total number  remove numbers at beginning of file  random word generator number of  remove random  new text generator  random word with numbers  generate random word number  numbers and word generator