Using `cal` and plain text to track things, Part II
Mon 27 November 2023
Back in September, I posted about using the output of cal
and plain text to track things. Here is the example of that format I listed in the post:
August 2023
Su Mo Tu We Th Fr Sa
. 2 3 . 5
. 7 . . . . .
. . . 16 . . .
. . . . . 25 .
. . . 30 .
2023/08/02 326 45 3.0 1/1 ell
2023/08/03 Swimming ~30 minutes
2023/08/05 Swimming 50min med diff
2023/08/07 393 50 3.48 2/1 elliptical
2023/08/16 345 50 3.29 2/1 elliptical
2023/08/25 1 hour intense swimming
2023/08/30 333 44 3.00 2/2 elliptical
I got so much great feedback from some "FediFriends"* immediately after that post that the next day, I came up with a script to automate the process of creating the "filtered" cal output automatically: fcal.
* post about what that means (for the uninitiated) coming soon
The core of the script is only roughly* 20 lines of shell (glorious things can be done in 20 lines of shell, my good fellow!!), half of which processes command line options (I could never get into using getopt
/getopts
), the other half of which constructs a sed
one-liner to do the actual filtering.
* not counting spaces, comments, individual if
/do
lines, and super-simple functions like warn()
and die()
Feeding the same data printed manually above into fcal
yields the following:
~ $ fcal -o Aug 2 3 5 7 16 25 30
August 2023
Su Mo Tu We Th Fr Sa
. 2 3 . 5
. 7 . . . . .
. . . 16 . . .
. . . . . 25 .
. . . 30 .
Nobody ever said shell was beautiful, but dang if it isn't insanely useful and quick to construct basic things!
Category: Tech Tagged: BSD Computing FOSS (Free and Open Source Software) Linux Non-religious post Productivity Unix Tips