Guys thank you so much. I realized how stupid I was as soon as I saw vermaden's answer. I cooked this based on your answers.
Code:
# This AWK script is written to automate generating of course calendar
# used for my syllabi
BEGIN {FS=" "; OFS="";
print "This program prints TeX calendar for the range of the months for the given year";
printf ("%s", "What is the year for which you want calendar? ") > "/dev/tty"
getline year < "/dev/tty";
printf ("%s", "Enter the first month for which you want calendar as number [1-12]. ") > "/dev/tty";
getline first_month < "/dev/tty";
printf ("%s", "Enter the last month for which you want calendar as number [1-12]. ") > "/dev/tty";
getline last_month < "/dev/tty";
{for (i=first_month; i<=last_month; i++)
system("cal" " " i " " year)}
}
{}
My goal is to automatically generate the snippet of TeX code which I use in my Syllabi. Something like follows just without lesson number (for examle without \tiny{6.6})
Code:
\begin{center}
\begin{small}
\begin{tabular}{||l|l|l|l|l||l|l|l|l|l||}
\hline
\multicolumn{5}{||c||}{January}&\multicolumn{5}{c||}{February}\\
\hline
\begin{minipage}{1cm}{\begin{center}Mon\end{center}}\end{minipage}&
\begin{minipage}{1cm}{\begin{center}Tue\end{center}}\end{minipage}&
\begin{minipage}{1cm}{\begin{center}Wed\end{center}}\end{minipage}&
\begin{minipage}{1cm}{\begin{center}Thu\end{center}}\end{minipage}&
\begin{minipage}{1cm}{\begin{center}Fri\end{center}}\end{minipage}&
\begin{minipage}{1cm}{\begin{center}Mon\end{center}}\end{minipage}&
\begin{minipage}{1cm}{\begin{center}Tue\end{center}}\end{minipage}&
\begin{minipage}{1cm}{\begin{center}Wed\end{center}}\end{minipage}&
\begin{minipage}{1cm}{\begin{center}Thu\end{center}}\end{minipage}&
\begin{minipage}{1cm}{\begin{center}Fri\end{center}}\end{minipage}\\
\hline
\tiny{3} & \tiny{4} & \tiny{5} & \tiny{6} & \tiny{7} &
\tiny{} & \tiny{1} & \tiny{2} & \tiny{3} & \tiny{4} \\
& & \tiny{Intro}& & &
& &\tiny{1.4, 1.5} & & \\
& &\tiny{R.2, R.4} & & &
& & & & \\
\hline
\tiny{10} & \tiny{11} & \tiny{12} & \tiny{13} & \tiny{14} &
\tiny{7} & \tiny{8} & \tiny{9} & \tiny{10} & \tiny{11} \\
\tiny{R.4, R.5}& &\tiny{R.7} & & &
\tiny{1,6, 1.7} & & \tiny{2.1, 2.2} & & \\
& & & & &
& & & & \\
\hline
\tiny{17} & \tiny{18} & \tiny{19} & \tiny{20} & \tiny{21} &
\tiny{14} & \tiny{15} & \tiny{16} & \tiny{17} & \tiny{18} \\
\tiny{MLK} & &\tiny{R.8} & & &
\tiny{2.3} & & \tiny{2.5} & & \\
\tiny{Day} & & & & &
& & & & \\
\hline
\tiny{24} & \tiny{25} & \tiny{26} & \tiny{27} & \tiny{28} &
\tiny{21} & \tiny{22} & \tiny{23} & \tiny{24} & \tiny{25} \\
\tiny{1.1, 1.2} & &\tiny{1.2, 1.3} & & &
\tiny{3.1, 3.2} & &\tiny{Review} & & \\
& & & & &
& & & & \\
\hline
\tiny{31} & \tiny{} & \tiny{} & \tiny{} & \tiny{} &
\tiny{28} & \tiny{} & \tiny{} & \tiny{} & \tiny{} \\
\tiny{\bf Exam 1} & & & & &
\tiny{\bf Exam 2} & & & & \\
& & & & &
& & & & \\
\hline
\multicolumn{5}{||c||}{March}&\multicolumn{5}{c||}{April}\\
\hline
\begin{minipage}{1cm}{\begin{center}Mon\end{center}}\end{minipage}&
\begin{minipage}{1cm}{\begin{center}Tue\end{center}}\end{minipage}&
\begin{minipage}{1cm}{\begin{center}Wed\end{center}}\end{minipage}&
\begin{minipage}{1cm}{\begin{center}Thu\end{center}}\end{minipage}&
\begin{minipage}{1cm}{\begin{center}Fri\end{center}}\end{minipage}&
\begin{minipage}{1cm}{\begin{center}Mon\end{center}}\end{minipage}&
\begin{minipage}{1cm}{\begin{center}Tue\end{center}}\end{minipage}&
\begin{minipage}{1cm}{\begin{center}Wed\end{center}}\end{minipage}&
\begin{minipage}{1cm}{\begin{center}Thu\end{center}}\end{minipage}&
\begin{minipage}{1cm}{\begin{center}Fri\end{center}}\end{minipage}\\
\hline
\tiny{} & \tiny{1} & \tiny{2} & \tiny{3} & \tiny{4} &
\tiny{} & \tiny{} & \tiny{} & \tiny{} & \tiny{1} \\
& \tiny{Midterm}&\tiny{3.4, 4.1}& & &
& & & & \\
& & & & &
& & & & \\
\hline
\tiny{7} & \tiny{8} & \tiny{9} & \tiny{10} & \tiny{11} &
\tiny{4} & \tiny{5} & \tiny{6} & \tiny{7} & \tiny{8} \\
\tiny{4.3, 4.5}& &\tiny{5.4} & & &
\tiny{No} & \tiny{No}&\tiny{No} &\tiny{No} & \tiny{No}\\
& & & & &
\tiny{Classes}& \tiny{Classes}& \tiny{Classes}& \tiny{Classes}&
\tiny{Classes}\\
\hline
\tiny{14} & \tiny{15} & \tiny{16} & \tiny{17} & \tiny{18} &
\tiny{11} & \tiny{12} & \tiny{13} & \tiny{14} & \tiny{15} \\
\tiny{6.1, 6.2}& & \tiny{6.3} & & &
\tiny{Review} & & \tiny{\bf Exam 3} & & \\
& & & & &
& & & & \\
\hline
\tiny{21} & \tiny{22} & \tiny{23} & \tiny{24} & \tiny{25} &
\tiny{18} & \tiny{19} & \tiny{20} & \tiny{21} & \tiny{22} \\
\tiny{6.4}& &\tiny{6.5} & & &
\tiny{8.1}& & \tiny{Review} & & \\
& & & & &
& & & &\\
\hline
\tiny{28} & \tiny{29} & \tiny{30} & \tiny{31} & \tiny{} &
\tiny{25} & \tiny{26} & \tiny{27} & \tiny{28} & \tiny{29} \\
\tiny{6.6}& &\tiny{6.7} & & &
\tiny{Review}& &\tiny{Review}& & \\
& & & & &
& & & & \\
\hline
\end{tabular}
\end{small}
\end{center}