Replace Pioneer Home   All Examples   Free Download

 New request --free  RSS: Replace Pioneer Examples

1456.Advanced search and replace -- How to delete blocks of text containing a specified string?

User: Poulp -- 2021-02-16          << 1455  1457 >>
Hits: 1507
Type: Advanced search and replace   
Search all Advanced search and replace examples
Description:
I need to delete blocks of text containing a specified string.
Input Sample:
<block_of_text> 
TEXT TEXT TEXT TEXT 
TEXT TEXT TEXT TEXT TEXT 
</block_of_text> 
 
<block_of_text> 
TEXT TEXT TEXT TEXT 
SPECIFIC STRING 
TEXT TEXT TEXT TEXT TEXT 
</block_of_text> 
 
<block_of_text> 
TEXT TEXT TEXT TEXT 
TEXT TEXT TEXT TEXT TEXT 
</block_of_text> 
 
<block_of_text> 
TEXT TEXT TEXT TEXT 
SPECIFIC STRING 
TEXT TEXT TEXT TEXT TEXT 
</block_of_text> 
 
<block_of_text> 
TEXT TEXT TEXT TEXT 
TEXT TEXT TEXT TEXT TEXT 
</block_of_text>
Output Sample:
<block_of_text> 
TEXT TEXT TEXT TEXT 
TEXT TEXT TEXT TEXT TEXT 
</block_of_text> 
 
<block_of_text> 
TEXT TEXT TEXT TEXT 
TEXT TEXT TEXT TEXT TEXT 
</block_of_text> 
 
<block_of_text> 
TEXT TEXT TEXT TEXT 
TEXT TEXT TEXT TEXT TEXT 
</block_of_text>
Answer:
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' dialog: 
* set 'search for pattern' to: 
 
* set 'if' to: 
 
3. click 'replace', done.

Screenshot 1:  Replace_Window


Similar Examples:
How to extract all blocks that contain specified strings like "A"? (72%)
How to split a text file according to specified tags? (63%)
How to remove lines containing specified words in a text file? (63%)
How to extract all sentences that contain specified words? (63%)
How to delete all lines containing specific word in specific column? (61%)
How to delete or copy text that match specified pattern of html tag? (61%)
How to replace old text with new text only in specified range? (61%)
How to shuffle all lines of text in specified range? (60%)

Check Demo of Advanced search and replace
Keywords:
blocks of text  blocks  block  matches  specific  containing  string  how to delete  delete  delet  delete string  delete specified  text string  delete text  replace a string  replace string  a string  delete 2