Thank Jean,
For calculating the previous month/year week the code is giving error.
when I run it displays week number as null for input value of "1 11"
I have replaced it with nawk now it displays as "0".
What will the
/^[[:digit:][:space:]]*$/ statement will do
can you explain .
Can you please helpme with this.
With "nawk"
myWeek=$(cal "{wmonth}" "${wyear}" | \
nawk '
/^[[:digit:][:space:]]*$/ && NF>0 {
if (substr($0, 1, 2) != " ") wm += 1;
}
END { printf("%d\n", wm) }
')
echo "myWeek number is -> [${myWeek}]"
Thanks a lot