[GLLUG] Bash scripting problem

John Levin john at technolalia.org
Tue May 16 17:11:05 UTC 2017


On 16/05/2017 15:28, Andy Smith via GLLUG wrote:
> Hi John,
>
> On Tue, May 16, 2017 at 03:21:44PM +0100, John Levin via GLLUG wrote:
>> What would be the best way to pass along to sed two strings like
>> "An ad to","An act to" ?
>
> Quote them.
>
> $ echo "An ad to" | sed -e "s/\bad\b/act/g"
> An act to
>
> http://wiki.bash-hackers.org/syntax/quoting
>
> Cheers,
> Andy
>

Many thanks for this, presume the \b mean \ before the space.
Not sure why the sed has to be enclosed in doubtle quotes, not single, 
had problems with the latter.

At any rate, have got this working, and I'm very grateful!
(As are the neighbours, for the furious cursing has stopped.)

John

-- 
John Levin
http://www.anterotesis.com
http://twitter.com/anterotesis



More information about the GLLUG mailing list