Every Mac comes with cal
which shows a simple calendar of current month. Output is something like this:
February 2014
Su Mo Tu We Th Fr Sa
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
I was wondering if we can use some sed
and date
magic and highlight today's number using ANSI escape sequences. I haven't tried anything because I don't know much about sed
.
Try this:
$ cal | grep -w -A4 -B6 $(date +%d)
-A4
and -B6
flags of grep
will print 4 lines after and 6 lines before the matching line.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments