[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: sed newlines



I tried this sed command and got the same response. I've had better luck 
with the 'substitute' command in sed. So I rewrote it slightly. 
Hopefully, this will give you your intended result:

sed -i 's/# cache_effective_user/&\ncache_effective_user 
squid\ncache_effective_group squid/' squid.conf


Gary Smithe wrote:

>Hi all,
>     I'm trying to use a sed one-liner to edit a file in-place
>(squid.conf).  Using Fedora Core 3, the following line works just
>fine:
>
>sed -i '/# cache_effective_user/a cache_effective_user
>squid\ncache_effective_group squid' /etc/squid/squid.conf
>
>On a Fedora Core 2 box, though (with sed 4.0.8), the newlines do not
>get interpreted, and all the lines run together, instead of giving me
>2 new lines, I get 1.
>
>I've tried different options and google searches, to no avail.
>
>Does anyone know how to do this with sed where "\n" doesn't work? 
>Optionally, perl will also work fine for me, but I need to append
>after regex'ing a line, and all I've found in perl one-liners is
>replacing text.
>
>
>Thanks in advance,
>
>Gary Smithe
>
>-
>To unsubscribe, send email to majordomo@silug.org with
>"unsubscribe silug-discuss" in the body.
>  
>

-- 
Tom Conder                                       http://www.gazpacho.net/
-------------------------------------------------------------------------



-
To unsubscribe, send email to majordomo@silug.org with
"unsubscribe silug-discuss" in the body.