Hans du Plooy wrote:
I'm trying to do a search/replace on some text. Looks like this: 1.2.3.4(1.2.3.4) To my mind, this should replace the '(' with a space sed 's/\\)/ / But it does nothing. Why? How do I do this?
$ echo "1.2.3.4(1.2.3.4)" | sed 's/(/ /' 1.2.3.4 1.2.3.4) $ echo "1.2.3.4(1.2.3.4)" | sed s/\(/\ / 1.2.3.4 1.2.3.4) Your version is missing the final ', so I'm guessing you meant: sed 's/\\)/ /' which will replace occurences of "\)" with a single space: eg: $ echo '2nd backslash and first paren replaced: \\))' | sed 's/\\)/ /' 2nd backslash and first paren replaced: \ ) Note that this is exactly the same as: $ echo '2nd backslash and first paren replaced: \\))' | sed s/\\\\\)/\ / 2nd backslash and first paren replaced: \ )Try the exercise of replacing the quote marks in the echo with double-quotes. Hours of fun for the whole family!