User: Aaron -- 2013-12-28 << 1163 1165 >> |
Hits: 3592 |
Type: Advanced search and replace |
Search all Advanced search and replace examples |
Description: |
How to randomly delete x number of lines from text inside and outside brackets? Thank you for scripts 1154 to 1157. Using similar methods I would like to randomly delete a specific number of text lines and/or fragments as follows: 1. Text outside brackets. 2. Text inside brackets. |
Input Sample: |
Line 1 aaaa bbb ccc ddd eee (some text in brackets) Line 2 aaaa bbbbbb c dd eee Line 3 aaaa bbb cc dd ee fff Line 4 (more text in brackets) Line 5 aaa bbb ccc d eee f ggg Line 6 aa (even more text) Line 7 a b ccc d e ff gg Line 8 aaaaa bbb ccc dd e ff gg (and more too) etc. |
Output Sample: |
1. Randomly delete 3 lines or fragments OUTSIDE brackets. Possible output: (some text in brackets) Line 2 aaaa bbbbbb c dd eee Line 3 aaaa bbb cc dd ee fff Line 4 (more text in brackets) (even more text) Line 7 a b ccc d e ff gg Line 8 aaaaa bbb ccc dd e ff gg (and more too) 2. Randomly delete 3 lines or fragments INSIDE brackets. Line 1 aaaa bbb ccc ddd eee Line 2 aaaa bbbbbb c dd eee Line 3 aaaa bbb cc dd ee fff Line 4 Line 5 aaa bbb ccc d eee f ggg Line 6 aa |
Answer: |
Hint: You need to Download and install "Replace Pioneer" on windows platform to finish following steps. |
Randomly remove 3 fragments of text inside bracket: 1. ctrl-o open text file 2. ctrl-h open 'replace' dialogue * set 'search for pattern' to: * set 'replace with pattern' to: * set 'if' to: * click 'advanced' tab, set 'run following at the beginning of replace' to: 3. click 'replace', done. Randomly remove 3 fragments of text OUTside bracket: 1. ctrl-o open text file 2. ctrl-h open 'replace' dialogue * set 'search for pattern' to: * set 'replace with pattern' to: * set 'if' to: * click 'advanced' tab, set 'run following at the beginning of replace' to: 3. click 'replace', done. |
Screenshot 1: Replace_Window |
Screenshot 2: Replace_Advanced_Window |