Hi lutech ,
Here is just a sample . You have to copy the following script
below into a file . Then execute the file .
Sample Script begins as shown below :
# !/bin/ksh
echo " Week of the Month Computation "
echo " ====================== \n"
echo "Enter the Year-Month-Date format :\c"
read user_input
# Variables
Year_value=`echo ${user_input} | cut -d"-" -f1,1 `
Month_value=`echo ${user_input} |cut -d"-" -f2,2 `
Date_value=`echo ${user_input} |cut -d"-" -f3,3 `
# Call calendar
cal ${Month_value} ${Year_value} | grep -v -i [a-z] > tmp1
echo "week_1
week_2
week_3
week_4
week_5
" > tmp2
wk=`paste tmp2 tmp1 | grep ${Date_value} | awk -F" " '{print $1}' `
# Cleanup temporary files
if [ -f tmp1 -a -f tmp2 ]
then
rm tmp1 tmp2 ;
fi
# Output to user
echo " The week for ${user_input} shall be ${wk} "
#Rgds , omari