Replace Pioneer Home   All Examples   Free Download

 New request --free  RSS: Replace Pioneer Examples

805.Text file parser -- How to extract all lines that contain chem, but not any of org and cn?

User: bruce lee -- 2011-06-23          << 804  806 >>
Hits: 2209
Type: Text file parser   
Search all Text file parser examples
Description:
How to extract all lines that contain chem, but not any of org and cn?
Input Sample:
www.pride-chem.com 
www.s-chem.com 
www.scs-chem.com 
www.sunvic-chem.com 
www.aqua-chem.com.cn 
www.arvechem.com.org 
www.emzchem.com.cn
Output Sample:
www.pride-chem.com 
www.s-chem.com 
www.scs-chem.com 
www.sunvic-chem.com
Answer:
Hint: You need to Download and install "Replace Pioneer" on windows platform to finish following steps.
1. ctrl-o open the source text file 
2. ctrl-h open 'replace' dialog 
* set 'replace unit' to 'Line' 
* set 'search for pattern' to: 
 
* uncheck option of 'Print unmatched unit' 
* check option of 'Enhnaced Regular Exp'(and uncheck "regular expression" option) 
* set 'replace with pattern' to: 
 
3. click 'replace', done. 
4. for multiple files, click 'batch...' button, and drag multiple files to "Batch Runner" window, and click "Batch Replace", done. 
 
Note: if you need reomve lines contain "cn" but not "cnn", you should use "\bcn\b" instead of "cn", here "\b" means word boundary.

Screenshot 1:  Replace_Window


Similar Examples:
How to extract all lines that contain A, but not any of B C D? (89%)
How to extract all lines that contain words A and B and C? (74%)
How to extract all lines that contain words in a list? (72%)
How to extract all links that contain imprint from a webpage? (70%)
How to extract all lines that contain specified words or phrases? (70%)
How to delete all lines that contain only a word and a blank? (68%)
How to extract all lines do not contain a list of keywords? (68%)
How to extract all lines that containing ABC or DEF with original order? (68%)

Check Demo of Text file parser
Keywords:
boundary  tea  toc  extract all lines  lines contain  extract all line  unmatched  unmatch  regular expression  expression  batch file extract lines pattern  regular all lines that contain  extract lines that contain pattern  extract lines that contain  extract all lines with word  batch file to extract lines of text  batch file set regular expression  extract all lines contain