Help in UNIX shell to copy part of file name to new file name

Hi,
I want to do the following in a Unix shell script and wonder if someone could assist me?

I want to take files in a specific directory that start with the name pxpur012 and copy them to the same directory with the file name not containg pxpur012. For example, I have files like pxpur012_1.html, pxpur012_10.html, pxpur012_20.html, etc. . I want to take these file and copy each to the same directory but minus the pxpur012. The end result will be new files named as follows:
1.html, 10.html, 20.html.

I may also want to add a character to the name, but not sure yet.

Any help would be greatly appreciated.

Thanks,

Linda

You can try something like this:

for x in *.html;do mv -vv $x ${x/px*_/};done

HI,

I tried that but replaced the mv with cp and errored with the message:

${x/px*_/}: The specified substitution is not valid for this command.

Here is the command I put in a shell script and ran the shell script:

for x in *.html;do cp -vv $x ${x/px*_/};done

thanks,

Linda

Or

for f in *.html; do cp "$f" "${f#*_}"; done

Hi yoda,

this works. If I wanted to replace the file if it already exists what do I add?

thanks to all for the help!!

Linda:)

---------- Post updated at 09:26 PM ---------- Previous update was at 09:05 PM ----------

Hi,
forget about replacing the file , I wasn't thinking straight and know what to do.

Thanks again for everyone's help! Greatly appreciated!!