Q:

Count/Enumerate files in folder filtered by content

I have a folder with lots of files with some data. Not every file has a complete data set.
The complete data sets all have a common string of the form 'yyyy-mm-dd' on the last line so i thought i might filter with something like tail -n 1, but have no idea how to do that.
Any idea how to do something like that in a simple script or bash command?

A:

for f in *
do
    tail -n 1 "$f" |
    grep -qE '^[0-9]{4}-[01][0-9]-[0-3][0-9]$' &&
    echo "$f"
done

