aboutsummaryrefslogtreecommitdiff
path: root/sdep.1
blob: 8cbdd244a5b751edcbfb5e5ddff0053398c44ccd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
.TH SDEP 1 sdep\-VERSION

.SH NAME
sdep \- a simple "date+event" line parser

.SH SYNOPSIS
.B sdep
.RB [ \-dv ]
.IR "[+format]"
.RB [ \-f 
.IR "[date]" ]
.RB [ \-t 
.IR "[date]" ]
.RB [ \-w
.IR format ]
.RB [ \-s
.IR string ]

.SH DESCRIPTION
.B sdep
reads lines of the form

.IR "date text"

from stdin and writes to stdout those lines such that
.IR date
is between the two dates specified by the
.IR \-f
and
.IR \-t
options, both of which default to the current minute.
The dates should correspond to a unique minute in time. The format for
.IR date
can be specified with the same syntax as for
.IR date (1).

.SH OPTIONS

.TP
.B \-d
print the default date format and exit.

.TP
.BI \-f " [date]"
initial date for the range (default: current minute). If
.I date
is not specified then there will be no lower bound for the dates.

.TP
.BI \-s " string"
change the string that separates the date from the text in the output
lines (deafult: "\t").

.TP
.BI \-t " [date]"
final date for the range (default: current minute). If
.I date
is not specified then there will be no upper bound for the dates.

.TP
.B \-v
print version information and exit.

.TP
.BI \-w " format"
change the format in which the date is written in the output lines.

.SH EXAMPLES
If
.I events.txt
contains lines formatted as
.I "date text"
then

sdep -f <events.txt

will print all the lines whose date is in the past, while

sdep -t -w "%A" <events.txt

will print all lines whose date is in the future, showing only the day of the
week and the text.

sdep -f "1999-01-01 00:00" -t "1999-12-31 23:59" -w "" <events.txt

will show only the
.I text
of all lines with a date in 1999. You can specify a different format for the
dates, for example

sdep +"%m/%d/%Y %I:%M%p" -t "12/31/2020 11:59pm" -w "" <events.txt

will match all dates from December 31st, 2020, one minute before midnight
(included). Note: this only works if your locale has an am/pm format, see
.IR date (1).

.SH AUTHORS
Sebastiano Tronto <sebastiano.tronto@gmail.com>

.SH SOURCE CODE
Source code is available at https://github.com/sebastianotronto/sdep

.SH SEE ALSO
.IR date (1),
.IR strftime (3),
.IR strptime (3)

Generated with cgit - Back to sebastiano.tronto.net