1DATEGREP(1)                      User Commands                     DATEGREP(1)
2
3
4

NAME

6       dategrep - Grep standard input for lines that match EXPRESSION.
7

SYNOPSIS

9       dategrep [OPTION]...  EXPRESSION
10

DESCRIPTION

12       Grep standard input for lines that match EXPRESSION.
13
14       EXPRESSION  may be date/times prefixed with an operator `<', `<=', `=',
15       `>=', `>', `!=', `<>' (if omitted defaults to `='),  which  will  match
16       lines with date/times which are older, older-equal, equal, newer-equal,
17       newer, or not equal respectively.
18
19       EXPRESSION may also be format specifiers infixed by above operators and
20       suffixed by a value (e.g. `%a="Wed"') which matches lines whose %a rep‐
21       resentation (weekday name abbreviated) is "Wed".
22
23       EXPRESSION may be statements as described  above  concatenated  through
24       `&&'  (for  conjunction)  or  `||'  (disjunction), both of which may be
25       parenthesised as per usual to change precedence (`&&' goes over `||').
26
27       If multiple date/times occur on the same line and any one of them  ful‐
28       fills the criteria then the line is considered a match and will be out‐
29       put.
30
31       Note:
32         Operations can be specified by options (--eq, --gt, ...) as well.
33         This serves solely as a means of convenience, e.g. the datetest  tool
34       has a
35         similar syntax.
36
37
38       Recognized OPTIONs:
39
40       -h, --help
41              Print help and exit
42
43       -V, --version
44              Print version and exit
45
46       -q, --quiet
47              Suppress message about date/time and duration parser errors.
48
49       -i, --input-format=STRING...
50              Input  format,  can be used multiple times.  Each date/time will
51              be passed to the input format parsers  in  the  order  they  are
52              given,  if a date/time can be read successfully with a given in‐
53              put format specifier string, that value will be used.
54
55       -b, --base=DT
56              For underspecified input use DT as a fallback to fill in missing
57              fields.   Also  used for ambiguous format specifiers to position
58              their range on the absolute time line.  Must be a  date/time  in
59              ISO8601 format.  If omitted defaults to the current date/time.
60
61       -e, --backslash-escapes
62              Enable interpretation of backslash escapes in the output and in‐
63              put format specifier strings.
64
65       -o, --only-matching
66              Show only the part of a line matching DATE.
67
68       -v, --invert-match
69              Select non-matching lines.
70
71       --from-locale=LOCALE
72              Interpret dates on stdin or the command line as coming from  the
73              locale LOCALE, this would only affect month and weekday names as
74              input formats have to be specified explicitly.
75
76       --from-zone=ZONE
77              Consider date/times on stdin as coming from the zone  ZONE,  de‐
78              fault: UTC.
79
80       -z, --zone=ZONE
81              Consider  date/times in EXPRESSION as coming from the zone ZONE,
82              default: UTC.
83
84       --eq   Lines match when date/times are equal to EXPRESSION.
85
86       --ne   Lines match when date/times are not the same as EXPRESSION.
87
88       --gt   Lines match when date/times are newer than EXPRESSION.
89
90       --lt   Lines match when date/times are older than EXPRESSION.
91
92       --ge   Lines match when date/times are newer than or equal EXPRESSION.
93
94       --le   Lines match when date/times are older than or equal EXPRESSION.
95
96       --nt   Lines match when date/times are newer than or equal EXPRESSION.
97
98       --ot   Lines match when date/times are older than or equal EXPRESSION.
99

FORMAT SPECS

101       Format specs in dateutils are similar to posix' strftime().
102
103       However, due to a broader range of supported calendars  dateutils  must
104       employ different rules.
105
106       Date specs:
107         %a  The abbreviated weekday name
108         %A  The full weekday name
109         %_a The weekday name shortened to a single character (MTWRFAS)
110         %b  The abbreviated month name
111         %B  The full month name
112         %_b The month name shortened to a single character (FGHJKMNQUVXZ)
113         %c  The count of the weekday within the month (range 00 to 05)
114         %C  The count of the weekday within the year (range 00 to 53)
115         %d  The day of the month, 2 digits (range 00 to 31)
116         %D  The day of the year, 3 digits (range 000 to 366)
117         %F  Equivalent to %Y-%m-%d (ymd's canonical format)
118         %g  ISO week date year without the century (range 00 to 99)
119         %G  ISO week date year including the century
120         %j  Equivalent to %D
121         %m  The month in the current calendar (range 00 to 19)
122         %Q  The quarter of the year (range Q1 to Q4)
123         %q  The number of the quarter (range 01 to 04)
124         %s  The number of seconds since the Epoch.
125         %u  The weekday as number (range 01 to 07, Sunday being 07)
126         %U  The week count,  day of week is Sun (range 00 to 53)
127         %V  The ISO week count,  day of week is Mon (range 01 to 53)
128         %w  The weekday as number (range 00 to 06, Sunday being 00)
129         %W  The week count,  day of week is Mon (range 00 to 53)
130         %y  The year without a century (range 00 to 99)
131         %Y  The year including the century
132         %_y The year shortened to a single digit
133         %Z  The zone offset in hours and minutes (HH:MM) with
134             a preceding sign (+ for offsets east of UTC, - for offsets
135             west of UTC)
136
137         %Od The day as roman numerals
138         %Om The month as roman numerals
139         %Oy The two digit year as roman numerals
140         %OY The year including the century as roman numerals
141
142         %rs In time systems whose Epoch is different from the unix Epoch, this
143             selects the number of seconds since then.
144         %rY In calendars with years that don't coincide with the Gregorian
145             years, this selects the calendar's year.
146
147         %dth  The day of the month as an ordinal number, 1st, 2nd, 3rd, etc.
148         %mth  The month of the year as an ordinal number, 1st, 2nd, 3rd, etc.
149
150         %db The business day of the month (since last month's ultimo)
151         %dB Number of business days until this month's ultimo
152
153       Time specs:
154         %H  The hour of the day using a 24h clock, 2 digits (range 00 to 23)
155         %I  The hour of the day using a 12h clock, 2 digits (range 01 to 12)
156         %M  The minute (range 00 to 59)
157         %N  The nanoseconds (range 000000000 to 999999999)
158         %p  The string AM or PM, noon is PM and midnight is AM.
159         %P  Like %p but in lowercase
160         %S  The  (range 00 to 60, 60 is for leap seconds)
161         %T  Equivalent to %H:%M:%S
162
163       General specs:
164         %n  A newline character
165         %t  A tab character
166         %%  A literal % character
167
168       Modifiers:
169         %O  Modifier to turn decimal numbers into Roman numerals
170         %r  Modifier to turn units into real units
171         %0  Modifier to turn on zero prefixes
172         %SPC  Modifier to turn on space prefixes
173         %-  Modifier to turn off prefixes altogether
174         th  Suffix, read and print ordinal numbers
175         b   Suffix, treat days as business days
176
177       By design dates before 1601-01-01 are not supported.
178
179       For  conformity here is a list of calendar designators and their corre‐
180       sponding format string:
181         ymd     %Y-%m-%d
182         ymcw    %Y-%m-%c-%w
183         ywd     %rY-W%V-%u
184         bizda   %Y-%m-%db
185         lilian     n/a
186         ldn        n/a
187         julian     n/a
188         jdn        n/a
189         matlab     n/a
190         mdn        n/a
191
192       These designators can  be  used  as  output  format  string,  moreover,
193       @code{lilian}/@code{ldn}  and @code{julian}/@code{jdn} can also be used
194       as input format string.
195
196

EXAMPLES

198         $ dategrep 2012-03-01 <<EOF
199         2012-02-28
200         2012-02-29
201         2012-03-01
202         2012-03-02
203         EOF
204         2012-03-01
205         $
206
207         $ dategrep '<2012-03-01' <<EOF
208         2012-02-28
209         2012-02-29
210         2012-03-01
211         2012-03-02
212         EOF
213         2012-02-28
214         2012-02-29
215         $
216
217         $ dategrep \!=2012-03-01 <<EOF
218         2012-02-28
219         2012-02-29
220         2012-03-01
221         2012-03-02
222         EOF
223         2012-02-28
224         2012-02-29
225         2012-03-02
226         $
227
228         $ dategrep =2012-03-01 <<EOF
229         Feb     2012-02-28
230         Feb     2012-02-29     leap day
231         Mar     2012-03-01
232         Mar     2012-03-02
233         EOF
234         Mar     2012-03-01
235         $
236
237         $ dategrep -o \<2012-03-01 <<EOF
238         Feb     2012-02-28
239         Feb     2012-02-29     leap day
240         Mar     2012-03-01
241         Mar     2012-03-02
242         EOF
243         2012-02-28
244         2012-02-29
245         $
246
247         $ dategrep '>=12:00:00' <<EOF
248         fileA   11:59:58
249         fileB   11:59:59  leap ?
250         fileNOON     12:00:00  new version
251         fileC   12:03:12
252         EOF
253         fileNOON     12:00:00  new version
254         fileC   12:03:12
255         $
256
257         $ dategrep -o '>=12:00:00' <<EOF
258         fileA   11:59:58
259         fileB   11:59:59  leap ?
260         fileNOON     12:00:00  new version
261         fileC   12:03:12
262         EOF
263         12:00:00
264         12:03:12
265         $
266
267         $ dategrep 2012-03-01 <<EOF
268         2012-02-28T10:00:00
269         2012-02-29T10:00:00
270         2012-03-01T10:00:00
271         2012-03-02T10:00:00
272         EOF
273         2012-03-01T10:00:00
274         $
275
276         $ dategrep '<2012-03-01' <<EOF
277         2012-02-28T10:00:00
278         2012-02-29T10:00:00
279         2012-03-01T10:00:00
280         2012-03-02T10:00:00
281         EOF
282         2012-02-28T10:00:00
283         2012-02-29T10:00:00
284         $
285
286         $ dategrep 2012-03-01T10:00:00 <<EOF
287         2012-02-28T10:00:00
288         2012-02-29T10:00:00
289         2012-03-01T10:00:00
290         2012-03-02T10:00:00
291         EOF
292         2012-03-01T10:00:00
293         $
294
295         $ dategrep '<2012-03-01T14:00:00' <<EOF
296         2012-02-28T10:00:00
297         2012-02-29T10:00:00
298         2012-03-01T10:00:00
299         2012-03-02T10:00:00
300         EOF
301         2012-02-28T10:00:00
302         2012-02-29T10:00:00
303         2012-03-01T10:00:00
304         $
305

AUTHOR

307       Written by Sebastian Freundt <freundt@fresse.org>
308

REPORTING BUGS

310       Report bugs to: https://github.com/hroptatyr/dateutils/issues
311

SEE ALSO

313       The full documentation for dategrep is maintained as a Texinfo  manual.
314       If  the info and dategrep programs are properly installed at your site,
315       the command
316
317              info (dateutils)dategrep
318
319       should give you access to the complete manual.
320
321
322
323dateutils 0.4.9                   August 2021                      DATEGREP(1)
Impressum