DGREP(1) User Commands DGREP(1)NAMEdgrep - Find date or time matches in input stream
SYNOPSISdgrep [OPTION]... EXPRESSION
DESCRIPTIONdgrep 0.2.7
Grep standard input for lines that match EXPRESSION.
EXPRESSION may be date/times prefixed with an operator `<', `<=', '=',
'>=', '>', `!=', `<>' (if omitted defaults to `='), which will match
lines with date/times which are older, older-equal, equal, newer-equal,
newer, or not equal respectively.
EXPRESSION may also be format specifiers infixed by above operators and
suffixed by a value (e.g. `%a="Wed"') which matches lines whose %a rep‐
resentation (weekday name abbreviated) is "Wed".
EXPRESSION may be statements as described above concatenated through
`&&' (for conjunction) or `||' (disjunction), both of which may be
parenthesised as per usual to change precedence (`&&' goes over `||').
If multiple date/times occur on the same line and any one of them ful‐
fills the criteria then the line is considered a match and will be out‐
put.
-h, --help
Print help and exit
-V, --version
Print version and exit
-q, --quiet
Suppress message about date/time and duration parser errors.
-i, --input-format=STRING
Input format, can be used multiple times. Each date/time will
be passed to the input format parsers in the order they are
given, if a date/time can be read successfully with a given
input format specifier string, that value will be used.
-e, --backslash-escapes
Enable interpretation of backslash escapes in the output and
input format specifier strings.
-o, --only-matching
Show only the part of a line matching DATE.
-v, --invert-match
Select non-matching lines.
Group: op
Operations can be specified by options as well. EXPRESSION must
then be a date/time and no concatenation through conjunction
(`&&') or disjunction (`||') operators is possible.
This serves solely as a means of convenience, e.g. the dtest
tool has a similar syntax.
--eq Lines match when date/times are equal to EXPRESSION.
--ne Lines match when date/times are not the same as EXPRESSION.
--gt Lines match when date/times are newer than EXPRESSION.
--lt Lines match when date/times are older than EXPRESSION.
--ge Lines match when date/times are newer than or equal EXPRESSION.
--le Lines match when date/times are older than or equal EXPRESSION.
--nt Lines match when date/times are newer than or equal EXPRESSION.
--ot Lines match when date/times are older than or equal EXPRESSION.
EXAMPLES
$ dgrep 2012-03-01 <<EOF
2012-02-28
2012-02-29
2012-03-01
2012-03-02
EOF
2012-03-01
$
$ dgrep '<2012-03-01' <<EOF
2012-02-28
2012-02-29
2012-03-01
2012-03-02
EOF
2012-02-28
2012-02-29
$
$ dgrep =2012-03-01 <<EOF
2012-02-28
2012-02-29
2012-03-01
2012-03-02
EOF
2012-02-28
2012-02-29
2012-03-02
$
$ dgrep =2012-03-01 <<EOF
Feb 2012-02-28
Feb 2012-02-29 leap day
Mar 2012-03-01
Mar 2012-03-02
EOF
Mar 2012-03-01
$
$ dgrep-o <2012-03-01 <<EOF
Feb 2012-02-28
Feb 2012-02-29 leap day
Mar 2012-03-01
Mar 2012-03-02
EOF
2012-02-28
2012-02-29
$
$ dgrep '>=12:00:00' <<EOF
fileA 11:59:58
fileB 11:59:59 leap second?
fileNOON 12:00:00 new version
fileC 12:03:12
EOF
fileNOON 12:00:00 new version
fileC 12:03:12
$
$ dgrep-o '>=12:00:00' <<EOF
fileA 11:59:58
fileB 11:59:59 leap second?
fileNOON 12:00:00 new version
fileC 12:03:12
EOF
12:00:00
12:03:12
$
$ dgrep 2012-03-01 <<EOF
2012-02-28T10:00:00
2012-02-29T10:00:00
2012-03-01T10:00:00
2012-03-02T10:00:00
EOF
2012-03-01T10:00:00
$
$ dgrep '<2012-03-01' <<EOF
2012-02-28T10:00:00
2012-02-29T10:00:00
2012-03-01T10:00:00
2012-03-02T10:00:00
EOF
2012-02-28T10:00:00
2012-02-29T10:00:00
$
$ dgrep 2012-03-01T10:00:00 <<EOF
2012-02-28T10:00:00
2012-02-29T10:00:00
2012-03-01T10:00:00
2012-03-02T10:00:00
EOF
2012-03-01T10:00:00
$
$ dgrep '<2012-03-01T14:00:00' <<EOF
2012-02-28T10:00:00
2012-02-29T10:00:00
2012-03-01T10:00:00
2012-03-02T10:00:00
EOF
2012-02-28T10:00:00
2012-02-29T10:00:00
2012-03-01T10:00:00
$
AUTHOR
Written by Sebastian Freundt <freundt@fresse.org>
REPORTING BUGS
Report bugs to: https://github.com/hroptatyr/dateutils/issues
SEE ALSO
The full documentation for dgrep is maintained as a Texinfo manual. If
the info and dgrep programs are properly installed at your site, the
command
info (dateutils)dgrep
should give you access to the complete manual.
dateutils 0.2.7 January 2014 DGREP(1)