Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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
sed -i 's/port="8080"/port="8000"/' test
more test
share|improve this answer

Your Answer


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.