Unix/Linux Go Back    

Shell Programming and Scripting BSD, Linux, and UNIX shell scripting — Post awk, bash, csh, ksh, perl, php, python, sed, sh, shell scripts, and other shell scripting languages questions here.


Shell Programming and Scripting

Thread Tools Search this Thread Display Modes
Old Unix and Linux 07-27-2011   -   Original Discussion by GQiang
GQiang's Unix or Linux Image
GQiang GQiang is offline
Registered User
Join Date: Jul 2011
Last Activity: 21 July 2012, 1:00 AM EDT
Posts: 30
Thanks: 9
Thanked 0 Times in 0 Posts

I dont get something about sed

If i have a text file inside contain


sed "s/"$title:$author:$price:$qtyAvailable:$qtySold"/"$Ntitle:$author:$price:$qtyAvailable:$qtySold"/"

This work!!


If i have a text file inside contain

Tom Tom:La La:Di Di :Do Do :De DE

It cannot work =(

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

Last edited by pludi; 07-27-2011 at 09:16 AM..
Sponsored Links
Old Unix and Linux 07-27-2011   -   Original Discussion by GQiang
Neo's Unix or Linux Image
Neo Neo is offline Forum Staff  
Join Date: Sep 2000
Last Activity: 17 March 2018, 11:04 AM EDT
Location: Asia pacific region
Posts: 14,332
Thanks: 979
Thanked 1,346 Times in 639 Posts

Per our forum rules, all threads must have a descriptive subject text. For example, do not post questions with subjects like "Help Me!", "Urgent!!" or "Doubt". Post subjects like "Execution Problems with Cron" or "Help with Backup Shell Script".

The reason for this is that nearly 95% of all visitors to this site come here because they are referred by a search engine. In order for future searches on your post (with answers) to work well, the subject field must be something useful and related to the problem!

In addition, current forum users who are kind enough to answer questions should be able to understand the essence of your query at first glance.

So, as a benefit and courtesy to current and future knowledge seekers, please be careful with your subject text. You might receive a forum infraction if you don't pay attention to this.

Thank you.

The UNIX and Linux Forums
Sponsored Links
Old Unix and Linux 07-28-2011   -   Original Discussion by GQiang
Chubler_XL's Unix or Linux Image
Chubler_XL Chubler_XL is offline Forum Staff  
Join Date: Oct 2010
Last Activity: 12 March 2018, 5:51 PM EDT
Posts: 3,484
Thanks: 154
Thanked 1,236 Times in 1,133 Posts
The spaces within your variables are being interpreted as additional parameters. Use 1 set of quotes around the whole s/// expression:

sed "s/$title:$author:$price:$qtyAvailable:$qtySold/$Ntitle:$author:$price:$qtyAvailable:$qtySold/"

Sponsored Links

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Curious about the -9 pflickner UNIX for Dummies Questions & Answers 3 11-17-2010 12:48 AM
curious kurosaki Shell Programming and Scripting 6 09-29-2008 09:54 AM
Curious? River Freight Linux 1 10-07-2007 03:40 PM
Curious Dummy highway39 UNIX for Dummies Questions & Answers 1 08-31-2006 07:22 PM
Curious skotapal UNIX for Dummies Questions & Answers 2 02-28-2003 03:33 PM

All times are GMT -4. The time now is 12:34 PM.