tr from the command line

Startseite
Anhänge:
Nachricht
+ (text/plain)
Nachricht löschen
Nachricht beantworten
Autor: Kevin Buettner
Datum:  
Betreff: tr from the command line
On May 14, 8:40pm, Carl Parrish wrote:

> I've got a lot of files called *_log. I want to change them all to
> *.log. I *think* I want to use the tr command. Can anyone give me
> the syntax? my undertanding from the info and man files isn't
> working.


Maybe something like this?

for f in *_log; do mv $f `echo $f | tr _ .`; done

However, I think using sed in this case might be better:

for f in *_log; do mv $f `echo $f | sed -e 's/_log$/.log/'`; done

Kevin