Sort and move multiple files by modification date

Hi I have a problem, I have a large group of archive files in a folder some are later versions of the same archive, the only difference btween them is that the archiving program we use appends the name with a code for it to keep track of in its data base, and the modification date.
I am starting to accumulate a large number of duplicate archive files am trying to find a way to isolate the files by name and move only the latest version to a new folder.
If any one has any ideas how I might accomplish this I would greatly appreciate if you could point me in the right direction.
I had thought that I could use list in some way and create a command from that with sed to move the correct files to another folder.
Thank you very much

Can you sort the files by it creation date? old files should be older,
can you place here an example to the files names (old+new)

Igal

And, tell us what OS and shell you're using...
and, show us what you have tried so far to solve your problem...
and, tell us what the pathname is for you new folder...
and, explain why you think sed would be a good tool to identify the files you want to move?

Hi again, I apologize for just getting back to you now.
The shell I am using is the Bash shell and the bsd version of sed, I'm on a mac.
An example of the file name I have to work with is;
20113_Zebra_WindowCat2014_93f7842-d959-46f1-b1f6-af652fc0f57.bkf
20113_Zebra_WindowCat2014_8015911e-0d8d-4dcf-b2d5-45733d7adb6e.bkf
The part of the string after the 2014 portion is added by the archive program we use to keep track of the latest version in its database, there is no logic that I can see for the string that the archive program adds.
I was thinking that I could list the the directory where the archives reside by date to a text file with the most recent files listing first.
I could use sed to eliminate duplicate lines so that only the most recent entry would be left in the list.
With sed I can reformat the list to a command to move the most recent files I want to a temporary directory while I clean up the original archive directory. Once the original archive directory is cleaned I can move only the most recent archive files back.
I think I'm a little clearer on what I need to do now that I have explained it you though. If you know of a different approach to solve this problem please let me know I would greatly appreciate your input.
Thanks again

Not highly efficient, but pretty simple...

ls -t | awk -F_ '/.bkf*/ && !s[$1 FS $2 FS $3]++' | while read f
do	echo mv "$f" dest_dir
done

Change dest_dir to the pathname of your destination directory. Remove the echo shown in red and rerun the script to actually move the files if the mv commands it shows you look right.

If you want to try this on a Solaris/SunOS system, change awk to /usr/xpg4/bin/awk , /usr/xpg6/bin/awk , or nawk .

Hi again, the script works like a charm, It really is a thing of beauty.
I am so grateful for your generousity with your time and talents.
Thanks so very much, you and Unix.com are the very best!!
Merry Christmas

I'm glad my suggested script is working for you.

Could you please explain how you would use sed to eliminate related files? I don't normally think of sed as an appropriate tool for that type of operation (especially when the files to be skipped over are not necessarily contiguous with the file that is to be kept).