sdep

A simple "date+event" line parser
git clone https://git.tronto.net/sdep
Download | Log | Files | Refs | README | LICENSE

sdep.1 (2161B)


      1 .Dd May 13, 2021
      2 .Dt SDEP 1
      3 .Os
      4 .Sh NAME
      5 .Nm sdep
      6 .Nd a simple "date+event" line parser
      7 
      8 .Sh SYNOPSIS
      9 .Nm
     10 .Op Fl dv
     11 .Op Ar +format
     12 .Op Fl f Op Ar date
     13 .Op Fl t Op Ar date
     14 .Op Fl w Ar format
     15 .Op Fl s Ar string
     16 
     17 .Sh DESCRIPTION
     18 .Nm
     19 reads lines of the form
     20 
     21 .Dl Ar "date text"
     22 
     23 from stdin and writes to stdout those lines such that
     24 .Ar date
     25 is between the dates specified by the
     26 .Fl f
     27 and
     28 .Fl t
     29 options, both defaulting to the current minute.
     30 The dates should correspond to a unique minute in time. The format for
     31 .Ar date
     32 can be specified with the same syntax as for
     33 .Xr date 1 .
     34 
     35 The options are as follows:
     36 .Bl -tag -width Ds
     37 .It Fl d
     38 print the default date format and exit.
     39 .It Fl f Op Ar date
     40 initial date for the range (default: current minute). If
     41 .Ar date
     42 is not specified there will be no lower bound for the dates.
     43 .It Fl s Ar string
     44 change the string that separates the date from the text in the output
     45 lines (deafult: "\t").
     46 .It Fl t Op Ar date
     47 final date for the range (default: current minute). If
     48 .Ar date
     49 is not specified then there will be no upper bound for the dates.
     50 .It Fl v
     51 print version information and exit.
     52 .It Fl w Ar format
     53 change the format in which the date is written in the output lines.
     54 
     55 .Sh EXAMPLES
     56 If
     57 .Ar events.txt
     58 contains lines formatted as
     59 .Ar "date text"
     60 then
     61 
     62 .Dl sdep -f <events.txt
     63 
     64 will print all the lines whose date is in the past, while
     65 
     66 .Dl sdep -t -w "%A" <events.txt
     67 
     68 will print all lines whose date is in the future, showing only the day of the
     69 week and the text.
     70 
     71 .Dl sdep -f "1999-01-01 00:00" -t "1999-12-31 23:59" -w "" <events.txt
     72 
     73 will show only the
     74 .Ar text
     75 of all lines with a date in 1999. You can specify a different format for the
     76 dates, for example
     77 
     78 .Dl sdep +"%m/%d/%Y %I:%M%p" -t "12/31/2020 11:59pm" -w "" <events.txt
     79 
     80 will match all dates from December 31st, 2020, one minute before midnight
     81 (included). Note: this only works if your locale has an am/pm format, see
     82 .Xr date 1 .
     83 
     84 .Sh AUTHORS
     85 .An Sebastiano Tronto Aq Mt sebastiano.tronto@gmail.com
     86 
     87 .Sh SOURCE CODE
     88 Source code is available at
     89 .Lk https://github.com/sebastianotronto/sdep
     90 
     91 .Sh SEE ALSO
     92 .Xr date 1 ,
     93 .Xr strftime 3 ,
     94 .Xr strptime 3