User: editor -- 2012-03-30 << 932 934 >> |
Hits: 3912 |
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 |