Wanted to eliminate numeric part from a filename

Hi,

I have a filename called XYZ12345.txt.I just want to eliminate numeric and have only XYZ.txt.

How can i do it ?

Regards,
Sona.

Multiple ways of doing it.

Here is one.

echo XYZ12345.txt | tr -d '[[:digit:]]'

With out the character class the tr statement would be

tr -d '0-9'

I have similar problem, but instead of numeric, i would like to remove a special character from a file name: i have a lot of log files that have '@' in the name of the file. Is the way to remove that character the same? Thank you in advance.

Change the pattern in tr

echo "@a@b" | tr -d '@'

Thank you for the response. But if i want to rename it, i can't use echo.
I want
history_acc@MTB-20060716.log
rename in
history_accMTB-20060716.log

I tried with mv, but it didn't work. The command i tried was:
mv history_acc@MTB-20060716.log history_acc@MTB-20060716.log | tr -d '@'.
Do you have any suggestions about that?

mv history_acc@MTB-20060716.log `echo history_acc@MTB-20060716.log | tr -d '@'.`

I tried that too. But instead of file named:
history_accMTB-20060716.log
i got file named
echo history_acc@MTB-20060716.log[/email] | tr -d '@'

yes, there were some VB tags got added automatically, I have updated above.

Assume you have tens of log files in the directory. It wouldn't be easy to rename all those files one by one.. Instead you can do this:

for var in `ls -1 | grep "@"`
do
   mv $var `echo "$var" | tr -d "@"`
done

this way you can remove the "@" characters from all your log files with one command..