How can I use
sed to match the search 'pattern' and reuse it again in the 'substitution' part?
Example: I want the command:
echo "12a34" | sed 's/a/#bcd/g'
What should be the
# parameter to get the right substitution?
As already commented, the solution is to take the
& character in the substitution part:
echo "12a34" | sed 's/a/&bcd/g'
Like this the
& is just replaced by the
a in the search pattern.