Help deciphering script

There are files on a remote server with the file name ending in "mm-dd-yy.txt". The script I am running is:

mls "Daily_Service_Text_File_*" /my/local/dir/Filelisting.txt
nawk -F_ -f file.awk /my/local/dir/Filelisting.txt | sort -k1n | cut -f2- | tail -1

It worked up too "12-31-07.txt" but it doesn't work for "01-dd-yy.txt".

Why??

Hard to say without seeing file.awk. But maybe because 12-31-07.txt comes after 01-dd-yy.txt in a sort? This is why year-month-day is better. The 2 digit year is not a great idea either. It will fail if any date is in a different century. A 4 digit year will work for thousands of years and most of us try to use a 4 digit year where ever we can.

DUH! You are correct! The list is sorted, so it's grabbing the last file which is 12 and not 01. I would need to modify to read differently.

Here's the contents of the .awk file

{
d=substr($NF, 1, index($NF, ".")-1)
split(d, dA, "-")
print dA[3] dA[1] dA[2] "\t" $0
}