Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I tried to use the sed command to do some text replacement,

sed -i 's/port=\"8080\"/port="\8000\"' /opt/apache-tomcat-7.0.37/conf/server.xml 

But I meet this error:

sed: -e expression #1, char 9: unterminated `s' command

What is the problem?

share|improve this question

1 Answer 1

Unterminated `s' command means you are missing a delimiter. You need 3 and have just 2 in your command.

sed -i 's/port=\"8080\"/port="\8000/"' /opt/apache-tomcat-7.0.37/conf/server.xml 

I flipped the last \ to / and it works:

more test
  port="8080"
sed -i 's/port="8080"/port="8000"/' test
more test
  port="8000"
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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