Insert search string back to the result in sed
Following command will replace "foo" by "bar", using the sed.
# echo "foo" | sed 's/foo/bar/'
But how to append the word "foo" at the end of "bar"?
Here is the solution with the & (& defines the pattern found in the search string)
# echo "foo" | sed 's/foo/bar&/'