September 15th, 2004, 02:42 AM
how to grep date format ddmmyyyy
can anyone help me in this:
I had to select file names in ddmmyyyy format from a list & have to make sure that selected file name should all the limitations of date,month & year such as date cannot exceed 31,30 or 28 depending upon the month.
September 15th, 2004, 02:19 PM
where listfile is a list of filenames
while read filename
# validate date/time a parameter entered
MMDD=$(expr substr $filename 5 4)
YYYY=$(expr substr $filename 1 4)
if touch -c -t $YYYY$MMDD$hh$mm.$ss dummyfile
echo "$filename is valid"
echo "$filename is invalid"
done < listfile