, which in this case it will count all files with extension "cdr" from the month of july, today the 13th of july.
I also use the same code to count files with extension "tap"
Did you consider using the find utility with all its options and tests?
And, you could use awk to distinguish file extensions and do the counting per extension for you.
Assuming that you are looking for files dated yesterday (and not July 13 on any earlier years), you need to verify that there is a : in field 8. You could try something like:
ls -l | awk '
$6 != "Jul" || $7 != 13 || !($8 ~ /:/) { next }
/[.]cdr$/ { c++ }
/[.]tap$/ { t++ }
END { printf(".cdr: %d\n.tap: %d\n", c, t) }'
If you want to try this on a Solaris/SunOS system, change awk to /usr/xpg4/bin/awk .
Bu my intention with the script is actually to put this file on a crontab, so that daily it would count and sent an email, but it looks like the way it is, it will only see the month of "july". Am I correct in saying this?