Not sure how to do the following, but any help would be appreciated.
Has to be done using C shell (sorry about that).
I have about 300 files that I need this done for, but I am only going to give one example. I will just need to know how to execute your solution through some type of loop to get all three files.
I have a file named data.ccyymmdd.dat.gz.
I need to copy that file to a new name, but take the ccyymmdd out of the original filename and put it into the name of the new filename.
This solution is great, but I think I might not have explained it correctly. i don't need the entire file name copied over, but just a portion. In my original example, there is a node in the file name that is a date, I just need the take that date and plug it into the new file name.
I will use part of your example, but modify it slightly.
ls sample*.*
sample.20100101.txt sample1.20110101.txt
sample10 20120101.txt sample2.20130101.txt