Sending script output as email

Hi
i have a script which executes daily through cron. The output of the script is appended to a log file everyday
It also emails me the output of the logfile as we have the mailx command in the script

The below is my requirement :

Normally When I get the email it sends the entire content in the log file. But I need only the script output content on the day it was executed.
To be more clear say for example if the script was executed on july 24th,25th and 26th. When i get the email on 24th it should send only the 24th log. Similarly when i get the email on 26th it should send only the 26th log.

How to do this ?

If the log file contains date in fixed format , easily you can grep lines that contains the logged lines

Instead of appending to the log file that you keep all daily output in. Direct your output to a daily log and email that to yourself. Then append the daily log into your historical log file by catting it into it. That way you have a daily log to meet your requirements and you have a historical log to go back every how many days you want.

Use tee to accomplish this.

regular_command_here | tee -a /var/some_log_file | mailx to_who_you_want