Replace Pioneer Home   All Examples   Free Download

 New request --free  RSS: Replace Pioneer Examples

1079.Regular expression replace -- How to remove everything after the second specified keywords in each line?

User: linana -- 2013-05-09          << 1078  1080 >>
Hits: 2012
Type: Regular expression replace   
Search all Regular expression replace examples
Description:
Remove all characters after the second key words per line

I now practice:
p0: p1: character ---- converted to spaces
P1: P2: then the first two words reserved
p2: p3: after each line add the word ----
p3: P4: whitespace characters converted to ----
I want to know there is no good way to solve the problem: (p0: p1)
Thank you
Input Sample:
a.txt
abc----123----sdfsdfs----ddddd
afd----sdfd32d----sie2323
d1cc----dddd----
Output Sample:
b.txt
abc----123----
afd----sdfd32d----
d1cc----dddd----
Answer:
Hint: You need to Download and install "Replace Pioneer" on windows platform to finish following steps.
You do not need so many steps, just a single step is fine.
1. ctrl-o open text file
2. ctrl-h open 'replace' dialogue
* set 'replace unit' to 'Line'
* set 'search for pattern' to:

* set 'replace with pattern' to:

3. click 'replace', done.

Screenshot 1:  Replace_Window


Similar Examples:
How to remove everything after specified strings in text files? (75%)
How to remove everything before first space in each line? (67%)
How to remove everything after the first comma in each line in a text file? (67%)
How to remove everything from start of line to the first comma in each line? (64%)
How to delete all text after the second comma in each line? (64%)
How to batch rename files by remove everything after specificed string? (63%)
How to remove everything between the products and the last slash in each line? (63%)
How to remove everything but specified strings between begin and end? (62%)

Check Demo of Regular expression replace
Keywords:
whitespace  first two words  reserve  everything after  remove everything after  good  first two  the first two  remove everything  two words  remove text after second  remove words after a word  remove words after  word replace everything after  add character after specified word  replace everything after a character in each line  remove everything after a word  remove the second key characters per line all characters