tr from the command line

Página superior
Adjuntos:
Obtener este mensaje como un correo
+ (text/plain)
Eliminar este mensaje
Responder a este mensaje
Autor: Kevin Buettner
Fecha:  
Asunto: 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