3

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.

Mohsen
  • 2,495
  • 4
  • 25
  • 29

2 Answers2

4

gcal(http://www.gnu.org/software/gcal/) is available from Homebrew and displays the current month with current day highlighted when invoked without any other args.

Eoin Kelly
  • 41
  • 2
2

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.

Ketan Maheshwari
  • 9,054
  • 6
  • 40
  • 53