I want the user to be able to search for the data according to month and year.
However, I cannot quite figure out how to do this. Above is the code i have and i can't understand what is wrong?
If we try and put in the variable e.g Nov, it wont give us any results.
It works only if instead of "$MONTH" we enter the month itself e.g Nov or Sep.
Admitted that rubin's way is much more clearer and readable, you can pass variables also interrupting and resuming the awk code by the means of single quotes, like I posted before.
The problem is that before I made a mistake, you also need to add a couple of double quotes to complicate things a little bit more
Caveat emptor:
The above approach does not work if the variable has whitespaces, newlines or certain special characters ( |, /, ...) in it.
So it's always recommended using the conventional way -v var=... .