Replace Pioneer Home   All Examples   Free Download

 New request --free  RSS: Replace Pioneer Examples

1059.Text file parser -- How to extract all paragraphs matching "spanning-tree" and remove the match line?

User: sam -- 2013-03-01          << 1058  1060 >>
Hits: 3704
Type: Text file parser   
Search all Text file parser examples
Description:
If the first line is matched, It will check next coming lines until meet "!" .  
And in Batch of files, if it find the paragraph with ¡°spanning-tree" and deleted  
it, it will export the processed paragraph to a new text file with "same" file  
name 
Input Sample:
file name : c:\a.txt 
 
 

xxx 
xxx 
zzz 
spanning-tree 

bbb 

aaa 
vvv 

 
 

interface TenGigabitEthernet2/2/1 
 xxxxx 
 yyyyy 
 nnnn 
 spanning-tree  -->need be deleted 
 bbbbb 
 ccccc 

 
 

interface TenGigabitEthernet1/0/3 
 xxxxx 
 spanning-tree  -->need be deleted 
 bbbbb 
 ccccc 

Output Sample:
file name : d:\a.txt 
 

interface TenGigabitEthernet2/1/1 
 xxxxx 
 yyyyy 
 bbbbb 
 ccccc 

 

interface TenGigabitEthernet1/0/1 
 xxxxx 
 yyyyy 
 bbbbb 
 ccccc 
!
Answer:
Hint: You need to Download and install "Replace Pioneer" on windows platform to finish following steps.
Assume each paragraph is seperated by a "!" 
1. ctrl-h open 'replace' window 
* set 'replace unit' to 'Paragraph' 
* set 'replace with pattern' to: 
 
* set 'If' to: 
 
* click 'settings' tab 
set 'para start' to: Other:  
2. click 'Batch' button open 'Batch Runner' window 
3. drag multiple text file from windows file browser to 'Batch Runner' window 
4. set 'Change output folder' to the output folder such as:  
5. click 'batch replace', all paragraph will be extracted and specified lines are removed, these paragraph will be written to new path d:\output\, done.

Screenshot 1:  Replace_Window


Screenshot 2:  Replace_Settings_Window


Similar Examples:
How to sort randomly(shuffle) all paragraphs that separated by ## in multiple files? (54%)
How to extract all characters within specified char set from a text file? (54%)
How to sort paragraphs according to order of first date? (53%)
How to delete all blank/space at the beginning of each line? (53%)
How to extract email from webpage and remove duplicate? (53%)
How to extract all links which contain "shop" from many html files? (53%)
How to extract all email addresses from many text files? (53%)
How to extract all words that has any letter doubled in a text file? (51%)

Check Demo of Text file parser
Keywords:
tabs  span  matching  paragraphs  written  abs  chin  seperate  export  path  remove paragraph same  find replace paragraph in text batch  find a matching paragraph in batch  matching lines  find next  remove first line of text from multiple files windows  line matching  remove same text multiple files