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 online now Forum Staff  
Join Date: Sep 2000
Last Activity: 24 June 2018, 3:16 AM EDT
Location: Asia pacific region
Posts: 14,403
Thanks: 1,001
Thanked 1,380 Times in 660 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: 21 June 2018, 11:38 PM EDT
Posts: 3,535
Thanks: 156
Thanked 1,261 Times in 1,155 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 03:17 AM.