Combining echo and cat on Unix
Posted
by Dan
on Stack Overflow
See other posts from Stack Overflow
or by Dan
Published on 2010-06-09T11:44:27Z
Indexed on
2010/06/09
12:12 UTC
Read the original article
Hit count: 245
Really simple question, how do I combine echo and cat in the shell, I'm trying to write the contents of a file into another file with a prepended string?
If /tmp/file looks like this:
this is a test
I want to run this:
echo "PREPENDED STRING"
cat /tmp/file | sed 's/test/test2/g' > /tmp/result
so that /tmp/result looks like this:
PREPENDED STRINGthis is a test2
Thanks.
© Stack Overflow or respective owner