| User: editor -- 2010-01-15 << 390 392 >> |
| Hits: 3304 |
| Type: Advanced search and replace |
| Search all Advanced search and replace examples |
| Description: |
| I have a file that I need to search 'ReplaceMe' and replace with 'New', but the replace shall only happen in the lines that contain 'ReplaceThisLine'. |
| Input Sample: |
| ... ReplaceThisLine ... ReplaceMe .... ReplaceMe ... ... ReplaceMe .... ReplaceMe .... ... ... ReplaceThisLine ... ... ReplaceMe .... ... ReplaceMe .... |
| Output Sample: |
| ... ReplaceThisLine ... New .... New ... ... ReplaceMe .... ReplaceMe .... ... ... ReplaceThisLine ... ... New .... ... ReplaceMe .... |
| Answer: |
| Hint: You need to Download and install "Replace Pioneer" on windows platform to finish following steps. |
| 1. ctrl-o open source text file 2. ctrl-h open 'Replace' dialog: * set 'Replace Unit' to 'Chars' * set 'Replace Scope' to 'Line' * set 'Search for pattern' to: * set 'Replace with pattern' to: * click 'Scope Filter' page, set 'Line Pattern' to: 3. Click 'Replace', done. 4. Ctrl-s save to file. |
| Download Script: scripts/391.rst.zip |
Similar Examples: |
| How to make search and replace only in specified lines in text file? (71%) How to replace old text with new text only in specified range? (69%) How to search and replace text for specified occurrences with reg exp? (68%) How to search and replace text base on csv file column 1 and 2? (64%) How to search and replace words in specified column in csv file? (64%) How to replace the certain column with specified words? (60%) How to search and replace in multiple files base on user-defined mapping file? (59%) How to replace word 'abc' to 'def' in specified lines like 1-10,18,20? (58%) |
Check Demo of Advanced search and replace |
| Keywords: |
| scope filter ppen specified line replace scope scope filter specified chars app contain replace lines that contain only search text lines contain replace contain search lines page text replace lines replace page |