Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 24 Sep 2001 20:06:33 +0200 (CEST)
From:      Salvo Bartolotta <bartequi@neomedia.it>
To:        Mark Rowlands <mark.rowlands@minmail.net>
Cc:        freebsd-questions@FreeBSD.ORG
Subject:   Re: silly sed question
Message-ID:  <1001354793.3baf762980f54@webmail.neomedia.it>

next in thread | raw e-mail | index | archive | help
> I have a string

> TARGETS='blob1 blob2 blob3'

> and I wish to use to change this to 

> TARGETS='blob1 blob2 blob3 blob4'    

> for a multitude of files.

> I am having problems with the quotes

> sed -e  '/^TARGETS  s/'$/blob4'/'  myfile

> ie find the line that begins with TARGETS and on that line swap the ending 
> single quote with blob4 and a single quote



Hello Mark,

>====> cat example
'string1 string2 string3'
'string5 string6 string7'

>====> sed -n '/^'\''string1 string2 string3/s/'\''$/ string4'\''/p' example
'string1 string2 string3 string4'

>====> sed '/^'\''string1 string2 string3/s/'\''$/ string4'\''/' example
'string1 string2 string3 string4'
'string5 string6 string7'

You've got the idea.

Maybe this is the simplest way. CMIIW.

-- Salvo (I'll get out and escape someone :-))

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1001354793.3baf762980f54>