LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   sed error message:extra characters after the command (http://www.linuxquestions.org/questions/programming-9/sed-error-message-extra-characters-after-the-command-472886/)

wmh830621 08-11-2006 03:59 AM

sed error message:extra characters after the command
 
Dear sir,
i am a newbie.I got the following message:
sed '/project/ a\ <server>' quote.txt
sed: -e expression #1, char 13: Extra characters after command
my quote.txt is:
<project>
</project>

druuna 08-11-2006 08:21 AM

Hi,

What is it you are trying to do?
Append <server> to project or replace project by <server>?

wmh830621 08-13-2006 08:20 PM

append <server> to <project>

druuna 08-14-2006 03:52 AM

Hi,

sed 's/<project>/<project><server>/' quote.txt

Or if you want to use sed's magic:

sed 's/\(<project>\)/\1<server>/' quote.txt

All between \( and \) can be written in the replace part as \1.

Hope this helps.

wmh830621 08-14-2006 07:13 PM

Thank you very much!


All times are GMT -5. The time now is 12:30 PM.