User: Aaron -- 2014-03-09 << 1182 1184 >> |
Hits: 3329 |
Type: Advanced search and replace |
Search all Advanced search and replace examples |
Description: |
How to limit each line to specified number of characters and not break word with following options: 1. Keep 1-40 characters of each line and delete rest of line 2. Keep characters from 41 to end of line and delete characters 1-40 |
Input Sample: |
More than 4.3 million homes collapsed or sustained damage, according to the Embassy in Washington. But casualty figures from various cities indicate a higher number of dead. |
Output Sample: |
Output Sample 1: (Keep 1-40 characters of each line and delete rest of line) More than 4.3 million homes collapsed or But casualty figures from various cities ---------------------------------------------------- Output Sample 2: (Keep characters from 41 to end of line and delete characters 1-40) sustained damage, according to the Embassy in Washington. indicate a higher number of dead. |
Answer: |
Hint: You need to Download and install "Replace Pioneer" on windows platform to finish following steps. |
Keep 1-40 characters: 1. ctrl-o open text file 2. ctrl-h open 'replace' dialogue * set 'replace unit' to 'Chars' * set 'replace scope' to 'Line' * set 'search for pattern' to: * set 'replace with pattern' to: * uncheck 'print unmatched unit' option 3. click 'replace', done. Remove 1-40 characters: Same as above, except that in step 2: * set 'replace with pattern' to 'blank' * check 'print unmatched unit' option If you want to do it in "batch runner" window. Keep 1-40 characters: 1. open "Tools->Batch Runner" menu 2. drag multiple files to batch runner window 3. click "Fast Replace" button 4. click "add" to add new rules: * set "search" to: * set 'replace' to: * click ok 5. check option of "reg exp" and "extract", uncheck option of "cross line" 6. click "start", done. Remove 1-40 characters: Same as above, except that in step 5: * set 'replace' to blank * uncheck 'extract' option |
Screenshot 1: Replace_Window |
Screenshot 2: Fast_Replace_Window |