?

Log in

No account? Create an account

Previous Entry | Next Entry

Sundays in a year ?

#!/bin/sh

NOYEAR=65
YEAR=$1
f_Usage()
{
echo "Usage: `basename $0` <Year>"
}
[ -z $YEAR ] && f_Usage && exit $NOYEAR
for j in `seq 12`
do
if [ `cal $j $YEAR | sed -n '3p' | wc -w` -lt 7 ]
then
        cal $j $YEAR |sed -e 3d -e 2d -e '/^$/d'|awk '{print $1}'|while read i; do echo -n $i; echo -n "/"; done
else
        cal $j $$YEAR |sed -e 2d -e '/^$/d'|awk '{print $1}'|while read i; do echo -n $i; echo -n "/"; done
fi
echo
done

<Run>
[jsaikia] ~/prac $ ./sundays 2008
January/6/13/20/27/
February/3/10/17/24/
March/2/9/16/23/30/
April/6/13/20/27/
May/4/11/18/25/
June/1/7/14/21/28/
July/6/13/20/27/
August/3/10/17/24/31/
September/7/14/21/28/
October/5/12/19/26/
November/2/9/16/23/30/
December/7/14/21/28/

Profile

jaduks
Jadu Kumar Saikia

Latest Month

January 2008
S M T W T F S
  12345
6789101112
13141516171819
20212223242526
2728293031  
Powered by LiveJournal.com
Designed by chasethestars