Reputation: 427
Im trying to sed insert:
echo "usr_web88_2" | sed 's/^\(usr\_\)'
but I can't find a solution
I have this string:
usr_web88_2
and want to add backslashes before the underscores like this:
usr\_web88\_2
Can anybody help me? thank you..
Upvotes: 1
Views: 4174
Reputation: 226
echo "usr_web88_2" | sed 's/_/\\_/g'
The g means global, which applies the expression to each match it finds on a line, not just the first.
Upvotes: 5