I am trying to write a script that shows every Friday in a month.
I used
cal $1 $2 | grep -v "^$" | awk '{print $6}'
It doesn't work for the frist week of Friday because calendar command output has some spaces in the first line and awk '{print $6}' doesn't work. Anybody help
me with this problem?
command
cal 12 2006
Note:The result has not aligned properly,check in your OS box.
EDIT -- It is aligned now because I added code tags and restored the original spacing of the output. -- Perderabo
December 2006
S M Tu W Th F S
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 29 30
31
the dates start from 3rd line,thats why he is omitting the first two lines by checking the condition line number greater than 2. NR >2
then starting from 3rd line get the starting character as 16 and number of characters as 2,as Friday dates starts from 16th character (fixed ).