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
1299.Text file parser -- How to extarct specified pattern by conditions?
User:
Soly -- 2015-04-23
<< 1298
1300 >>
Hits:
2784
Type:
Text file parser
Search all
Text file parser
examples
Description:
How to extarct by conditions?
only the value of MD is needed to be extracted. but if it doesn't exist, then extract the value of OD.
Input Sample:
File1
LD="AA"
MD="BB"
ND="CC"
OD="DD"
File2
LD="AA"
XD="BB"
ND="CC"
OD="DD"
Output Sample:
File1
BB
File2
DD
Answer:
Hint: You need to
Download and install "Replace Pioneer"
on windows platform to finish following steps.
1. ctrl-o open text file
2. ctrl-h open 'replace' dialogue
* set 'search for pattern' to:
MD="([^"]*)".*|ND="([^"]*)"(?!.*MD=.*)
* set 'replace with pattern' to:
$1$2
* uncheck "print unmatched units" option
3. click 'replace', done.
Screenshot 1: Replace_Window
Similar Examples:
How to extract specified text from pdf files?
(71%)
How to extract specified interface and sw from router configuration file?
(65%)
How to move strings matching specified patterns?
(63%)
How to extract text between specified start and end strings?
(63%)
How to search specified pattern in a text file and remove spaces in it?
(61%)
How to extract specified lines in different section of text file?
(60%)
How to add a new line return after specified char combinations?
(60%)
How to extract different part from adjacent lines?
(59%)
Check Demo of
Text file parser
Keywords:
condition
extracte
unmatched
unmatch
specified
value
print
text file parser
file parser
parser
extract value
if then
only search text
extract if
text file search extract
open print file
open print
text file parser open