replacing charater

I need a help here. My administrator made some changes and we couldn't access some files any more.

I am trying to replace a list of files from one format to another. Can anyone help me please?

Here is an example of

aaa_bbbb_cccccc.03172002_02:30:08

How can I replace the ':' with '_' for all files of considering the fact there are different lenght of files, but with the same format.

Thanks,

Odogbolu98
:confused:

Are those file names?
If so, you could do something like this:

for each in *:*; do mv $each `echo $each |tr : _`; done

This should work on reasonably modern shells.
If you have a specific shell in mind, it may be written a little differently, but this should work for general purposes. It may also fail if you have thousands of files in this directory...

If you have any problems, please post back.

Thanks Livingfree for your help.

Due to the urgency of the problem. I had to settle for another solution.

What I did was,

ls| grep : | awk -F\: '{print $1 "" $2 "" $3}'

I was able to get the new name first and then copied the old file into the new name and erase the old file. This work fine. However I'll try my hand on your suggestion.

Thanks,

Odogbolu98

Your method is probably safer - copy the file first, then remove later if everything worked correctly...

Either way works!