LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
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 11-02-2009, 01:09 AM   #1
whatis
LQ Newbie
 
Registered: Oct 2009
Posts: 12

Rep: Reputation: 0
sed: Unterminated 's' command


Hi,

I am using the 'search & replace' option of the 'sed' command and I am getting the error "unterminated `s' command"

The command looks like
sed 's/default=$ORIG_COUNT/default=$COUNT/' test

where I want to change the 'default' value in the 'test' file.

Plz help!
 
Old 11-02-2009, 01:14 AM   #2
raskin
Senior Member
 
Registered: Sep 2005
Location: France
Distribution: approximately NixOS (http://nixos.org)
Posts: 1,900

Rep: Reputation: 69
That exact command works on my box. Note that you probably want to use double quotes, because as you posted the command is evaluated with variables not expanded. You may also want to use -i option to edit the file in-place instead of printing the result of replace command.
 
Old 11-02-2009, 02:19 AM   #3
whatis
LQ Newbie
 
Registered: Oct 2009
Posts: 12

Original Poster
Rep: Reputation: 0
There was a minor mistake. The command should be

sed 's/default='$ORIG_COUNT'/default='$COUNT'/' test

It works fine! Thanks!!
 
  


Reply



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
Problem using sed with variable created using xargs - unterminated error wrankin Programming 5 11-14-2011 07:53 PM
SED Command racingdynamics Linux - General 4 07-25-2006 02:09 PM
sed command help... Pete.Hanson@jacobs.c Programming 8 06-02-2006 05:53 PM
sed Command linuxdev Linux - Newbie 3 02-09-2004 11:27 AM
sed command kwigibo Linux - General 3 04-21-2002 04:11 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:50 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
Open Source Consulting | Domain Registration