I need to count number of Sundays for a given month. For example if I want to get number of Sundays in DEC 2011 I do:
$ ncal -m 12 | grep Su | echo $(( `wc -w` - 1))
this returns 4. All good so far but I also need to do it for next year and I do not see to find an option for ncal to output only single month instead of whole year:
$ ncal -m 12 -y 2012
Is there any other way to get same result for next year without over-complicating things?