Is this a homework assignment? Homework assignments must be posted in the
Homework & Coursework Forum and must include a completely filled out
homework & coursework template.
When asking questions in these forums, it is always a good idea to tell us what operating system and shell you are using.
For questions concerning the handling of dates and times, it is crucial. Date processing on some systems is MUCH simpler than it is on some other systems. What operating system are you using?
What shell are you using? (And, if it is a Korn shell (
ksh), what version is it?)
And, if you can't give us an example of what output you're trying to produce from your sample input (and a specific date and time at which the script is run), I don' see how we can help.
I have never seen a script that would be able to send an e-mail message to someone and force the recipient of that e-mail to send that message to a physical printer. I'm guessing that that isn't really what you mean, but that is what your description requires.
There are LOTS of things missing from these requirements that make creating a script for this impossible:
- What date applies to lines that don't have dates on them? Is it the current date? Is it the date specified on the first line before it that contains a date? Is it the date specified on the first line after it that contains a date?
- What year is associated with dates in column 2? Is it the current year if the date on that line is less than or equal to the current date and the previous year if the date on that line is greater than the current date? Is it always in the current year?
- In the requirement: "Now I need a script to add column 2nd and column 3rd entries and compare it with current time( HH:MM format) and if it exceeds more than 15 min then I should get all such column A entries printed in email body.", what does all such column A entries mean? All lines that contain the string contained in column 1? All lines that contain the string contained in column 1 in column 1? Just print column 1 from lines where column 2 + column 3 + 15 minutes is earlier in the day than the current time in the current day? Please give us a clear specification of what you are trying to do!
There are other ambiguities in your requirements. Please write clear requirements and show us examples (in CODE tags) that highlight how those requirements affect the output you're trying to produce.