I would like to copy some files in a directory, renaming the files but conserving extension. Is this possible with a simple cp, using regex ?
For example :
cp ^myfile\.(.*) mydir/newname.$1
So I could copy the file conserving the extension but renaming it. Is there a way to get matched elements in the cp regex to use it in the command ?
If not, I’ll do a perl script I think, or if you have another way…
Thanks
Suppose you have
myfile.a,myfile.b,myfile.c:This creates (upon removal of
echo)newname.a,newname.b,newname.c.