Script help

Dennis Kaptain dkaptain at yahoo.com.mx
Fri Sep 19 21:01:29 UTC 2008


> 

> I've been googling to find ways of doing this but I'm not finding what
> I'm looking for. I think this should be fairly easy, so I'm hoping a
> script guru out there can tell me what I need.
> 
> I have some files that are all named like:
> myfile387465893495643658734.txt
> myfile547647453645635632454.txt
> myfile563546356243546767546.txt
> myfile465565634678567345656.txt
> myfile456674567452345566345.txt
> 
> I need to find all files that start with 'myfile', end in .txt Then I
> need to find the most recent version and use it in a command.
> 
> Can anyone rattle this off of the top of their head?
> 
> Help is appreciated.
> 
> Thanks,
> James
> 


This will tell you the most recent version of a file that starts with myfile and ends with .txt
 ls -t1 myfile*.txt | head -n1

How do you want to use that?

Dennis K


__________________________________________________
Correo Yahoo!
Espacio para todos tus mensajes, antivirus y antispam ¡gratis! 
Regístrate ya - http://correo.yahoo.com.mx/ 




More information about the fedora-list mailing list