Replace Pioneer Home   All Examples   Free Download

 New request --free  RSS: Replace Pioneer Examples

827.Text file parser -- How to extract all lines with specified date range from text file?

User: editor -- 2011-07-28          << 826  828 >>
Hits: 2822
Type: Text file parser   
Search all Text file parser examples
Description:
How to extract all lines with specified date range from text file?
There is a date with format YYYY-MM-DD at the end of each line, how to extract all lines that has date range from 2010-08-01 to 2010-09-30?
Input Sample:
.........  2010-08-05
............. 2011-04-12
.......... 2006-11-18
........... 2010-09-13
............. 2010-06-04
Output Sample:
.........  2010-08-05
........... 2010-09-13
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' dialog
* set 'replace unit' to 'Line'
* set 'replace with pattern' to:

* uncheck "print unmatched unit" option
* set 'If' to:

3. click "Replace", done.
4. ctrl-s save to file.

Note: (1) Above operation means extract all lines if the last word of the line within 2010-08-01 and 2010-09-31

words($match,-1) means the last word of the line
ge means "greater or equal to"
le means "less or equal to"

(2) You need to make date conversion if date is not format of YYYY-MM-DD

Screenshot 1:  Replace_Window


Similar Examples:
How to extract all specified date format from a text file? (85%)
How to extract multiple lines in specified order from many text files? (82%)
How to shuffle all elements in a specified range in text file? (76%)
How to extract all lines with numbers from many text files? (75%)
How to extract all lines by specified words in group? (72%)
How to extract all characters within specified char set from a text file? (72%)
How to extract all specified links from a html file? (72%)
How to extract lines containg specified words from many files? (70%)

Check Demo of Text file parser
Keywords:
greater  within  conversion  equal  yyyy  range  last word  less  how to extract all lines with  extract all lines with  extract lines with date range  how to extract a range of lines from a file  extract range of lines from text file  less extract lines  extract range of text  extract text line range  date extract from text file  extract date from text file