This should be really easy but I am perplexed.
I have a directory with about 500-600 files with filenames in two
different name formats. The files are either named according to
yymmdd i.e. 100809 or yymmdd.ext i.e 100809.txt -- how can I find the
last occurrence (by the date found in the filename) of a particular
string (in this case, "CSLIP")?
Among several variations, I tried:
lastfile=$( grep "CSLIP" `ls -1` | tail -1 )
but the files with extensions are always listed first in this way
(even though ls -1 is, of course, sorted properly at the shell). I
don't get it.