0

I have an HTML file on a Linux server that contains a long list of links. I am trying to edit this file as follows.

Find original occurrences of this type: http://www.test.org/name Replace them with: http://www.test.org/archive/name

How can I do this? I have tried running: sed -i -e 's/http://www.test.org/name/http://www.test.org/archive/name/g' user.html

However I get the following error back:

sed: couldn't open file ww.test.org/name/http://www.test.org/archive/name/g: No such file or directory

I am aware that there are questions that answer similar queries, but they have not been of help.

3

/ is default sed subexpression separator, use another one:

sed -i 's~http://www.test.org/name~http://www.test.org/archive/name~g' user.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.