Replace Pioneer Home   All Examples   Free Download

 New request --free  RSS: Replace Pioneer Examples

1154.Advanced search and replace -- How to randomly deletes x number of lines from text files?

User: Aaron -- 2013-12-05          << 1153  1155 >>
Hits: 1548
Type: Advanced search and replace   
Search all Advanced search and replace examples
I would like a script that randomly deletes x number of lines from text files.
Input Sample:
line 1. aaaaaaaaaaaaa
line 2. bbbbbbbbbbb
line3. ccccccccccccc
line 4. ddddddddddd
line 5. eeeeeeeeeeeee

Remove 2 lines randomly.
Output Sample:
line 2. bbbbbbbbbbb
line3. ccccccccccccc
line 4. ddddddddddd

line 1. aaaaaaaaaaaaa
line 4. ddddddddddd
line 5. eeeeeeeeeeeee
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 randomly delete x number of lines from text inside and outside brackets? (79%)
How to randomly insert a word or phrase x number of times into text files? (71%)
How to delete duplicate numbers in every line in text file? (70%)
How to sort and delete duplicate lines of a text file? (69%)
How to delete duplicate lines of a text file? (69%)
How to remove/delete all blank lines in a text file? (68%)
How to translate the hex number to decimal number inside a text file? (67%)
How to extract all telephone numbers from a text file? (66%)

Check Demo of Advanced search and replace
randomly  script  scrip  scr  number of lines  random  rando  rand  delete  delet  split text file number of lines  search and replace join lines  replace unit script  run script  script run  randomly replace text file  replace randomly  randomly replace