Replace Pioneer Home
All Examples
Free Download
all
Advanced search and replace
Replace text in multiple files
Regular expression replace
Batch file rename
Batch download
Text file parser
Text file splitter
Html text generator
Search replace binary
Random word generator
Count and statistics
Character encoding
Bin Hex Oct Dec converter
Text generator
Text sort
Text merge
Text data calculation
RSS: Replace Pioneer Examples
569.Advanced search and replace -- How to remove all lines that are not ended with word "ok" or "done"?
User:
editor -- 2010-07-21
<< 568
570 >>
Hits:
3203
Type:
Advanced search and replace
Search all
Advanced search and replace
examples
Description:
How can I keep all lines that ended with "ok" or "done" but remove all other lines?
Input Sample:
..... line1
...............line2
..............line3 ok
................line4
...........line5 done
...................
Output Sample:
..............line3 ok
...........line5 done
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" window
* set "replace" unit to "Line"
* set "Search for pattern" to:
(ok|done)$
* set "Replace with pattern" to:
$match\n
* uncheck "print unmatched unit" option
3. click "Replace", done!
Screenshot 1: Replace_Window
Similar Examples:
How to remove all the lines that do not contain any of words in a list?
(68%)
How to remove all lines that contains more than one word?
(67%)
How to remove all lines that can be found in another file?
(64%)
How to remove all lines that contain one or more words in a list?
(62%)
How to remove all blank lines and lines that started with Name: or Addr:?
(62%)
How to remove all lines that have duplicate contents in CSV files?
(61%)
How to remove or keep the lines started with a word of number?
(60%)
How to delete/remove all lines that appearred more than once?
(59%)
Check Demo of
Advanced search and replace
Keywords:
keep
remove all lines
unmatched
remove all line
unmatch
print
remove all
end
matched unit
how to remove
keep lines
remove lines with word
remove word
remove lines all
remove lines with
remove lines
remove all text
open print