Run script from another script if system date was reached

I what to find a system date in a shell script and search for it in a file in specific record.
If the record (ENDC) has the same date I what to execute another shell script.

Here is example of the file:

Can someone please help me with this ?

Maybe this is what your looking for...

#!/bin/ksh

typeset -i record_cnt=$(grep -c "ENDC.*$sysDate" file1)
if (( $record_cnt > 0 )); then
  execute_script.sh
fi

If you are using bash shell use the following script.

#!/bin/sh

date=`date "+%Y%m%d"`
typeset -i record=$(grep -c "ENDC.*$date" fil)
echo $record;
if [[ $record -gt 0 ]]; then
        sh another_script.sh
fi

The following POSIX date command will give you that last day of the previous month (including the previous year) in an easily parsed format:

date  -j -v1d -v-0m -v-1d +'%m %d %Y'

The -j flag says 'don't change the system date based on what follows'

The -v option returns adjustments to the current date. There can be more than one and interpreted left to right. So:
'-v1d' sets the first date of the current month;
'-v-0m' subtracts zero months, but could be different if you want the last day of another month;
'-v-1d' subtracts 1 day from the first of the month giving the last day of the previous month.
'%m %d %Y' gives the format of '02 28 2010' if you run this command any day this month.

Now just parse that with BASH, awk or perl and you are on your way.

Hope that helps...