Combinación de echo y cat en Unix


Pregunta realmente simple, ¿cómo combino echo y cat en el shell, estoy tratando de escribir el contenido de un archivo en otro archivo con una cadena antepuesta?

Si el archivo/tmp / se ve así:

this is a test

Quiero ejecutar esto:

echo "PREPENDED STRING"
cat /tmp/file | sed 's/test/test2/g' > /tmp/result 

Para que / tmp / result se vea así:

PREPENDED STRINGthis is a test2

Gracias.

Author: Dan, 0000-00-00

1 answers

Esto debería funcionar:

echo "PREPENDED STRING" | cat - /tmp/file | sed 's/test/test2/g' > /tmp/result 
 34
Author: Douglas,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2010-06-09 12:09:35