LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices



Reply
 
Search this Thread
Old 08-11-2006, 04:59 AM   #1
wmh830621
LQ Newbie
 
Registered: Jul 2006
Posts: 7

Rep: Reputation: 0
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>
 
Old 08-11-2006, 09:21 AM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374
Hi,

What is it you are trying to do?
Append <server> to project or replace project by <server>?
 
Old 08-13-2006, 09:20 PM   #3
wmh830621
LQ Newbie
 
Registered: Jul 2006
Posts: 7

Original Poster
Rep: Reputation: 0
append <server> to <project>
 
Old 08-14-2006, 04:52 AM   #4
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374
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.
 
Old 08-14-2006, 08:13 PM   #5
wmh830621
LQ Newbie
 
Registered: Jul 2006
Posts: 7

Original Poster
Rep: Reputation: 0
Thank you very much!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Getting last characters of a line with sed command LULUSNATCH Programming 4 12-21-2005 10:33 AM
Extra characters in CuteCom jdupre Linux - Software 0 06-17-2005 08:02 PM
sed error message: extra characters after the command. nano_mag Linux - General 3 05-15-2005 02:00 AM
KDE Konsole adding extra characters Tiyogi Linux - Software 2 04-26-2004 04:21 PM
using sed to grab two characters? nausicaa3000 Programming 4 04-20-2004 12:01 PM


All times are GMT -5. The time now is 11:56 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration