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
598.Text file parser -- How to extract all lines in which the first character is the same as last character?
User:
editor -- 2010-08-26
<< 597
599 >>
Hits:
279
Type:
Text file parser
Search all
Text file parser
examples
Description:
How to extract all lines in which the first character is the same as last character?
How to extract all lines that has format of X******X from a text file, "X*****X" means the first character is the same as last character.
Input Sample:
about
aha
blog
dad
too hot
replace pioneer
Output Sample:
aha
dad
too hot
replace pioneer
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:
^(.).*?\1$
* set 'replace with pattern' to:
$match\n
* uncheck 'Print unmatched unit' option
3. click 'Replace', done!
4. ctrl-s save to file
Screenshot 1: Replace_Window
Similar Examples:
How to extract all lines longer than 80 characters from a text file?
(64%)
How to extract all lines with more than 30 characters from multiple files?
(62%)
How to extract all lines that has no leading spaces?
(58%)
How to replace the first 3 characters of each line to fixed characters and add 'a' at the end?
(57%)
How to extract the first 10 and last 10 characters from each line?
(56%)
How to extract all lines that contain words A and B and C?
(56%)
How to extract all lines that has more than 2 numbers?
(55%)
How to batch rename files to the first 8 characters of the second line of file content?
(55%)
Check Demo of
Text file parser
Keywords:
first character
same
last
unmatched
unmatch
las
print
file parser
text file parser
parse
extract character
replace first character
extract text first
extract first
text file search extract lines
replace first last
save lines from text file
extract lines text