Home Man
Search
Today's Posts
Register

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.

Curious

Tags
shell scripts

👤 Login to reply

 
Thread Tools Search this Thread
# 1  
Old 07-27-2011
Curious

I dont get something about sed

If i have a text file inside contain
Code:
a:a:a:a:a

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

This work!!

but

If i have a text file inside contain
Code:
Tom Tom:La La:Di Di :Do Do :De DE

It cannot work =(
error
Code:
sed: -e expression #1, char 7: unterminated `s' command


Last edited by pludi; 07-27-2011 at 09:16 AM..
# 2  
Old 07-27-2011
Hello,

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
# 3  
Old 07-28-2011
The spaces within your variables are being interpreted as additional parameters. Use 1 set of quotes around the whole s/// expression:

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

👤 Login to reply

« Previous Thread | Next Thread »
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Two curious questions jamie_123 Shell Programming and Scripting 7 10-03-2012 12:35 PM
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 'ls' Issue vibhor_agarwali UNIX for Advanced & Expert Users 7 07-10-2008 03:19 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
Just curious, does Unix stand for anything? pudad UNIX for Dummies Questions & Answers 6 10-18-2002 01:06 AM


All times are GMT -4. The time now is 05:15 AM.

Unix & Linux Forums Content Copyright©1993-2018. All Rights Reserved.
UNIX.COM Login
Username:
Password:  
Show Password