Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 12 Sep 2025 10:22:36 -0100
From:      Arthur Chance <freebsd@qeng-ho.org>
To:        Frank Leonhardt <freebsd-doc@fjl.co.uk>, freebsd-questions@freebsd.org
Subject:   Re: [List] Re: Nice easy sed question
Message-ID:  <ce6d67d5-83eb-44fb-a8bf-fbc0b00e77b7@qeng-ho.org>
In-Reply-To: <4c223de1-6ed0-4f56-9b50-6cc1355a9790@fjl.co.uk>
References:  <c1ba0b3e-2754-4bc7-af0b-b570a7693c7a@fjl.co.uk> <20250911221857100915167@bob.proulx.com> <4c223de1-6ed0-4f56-9b50-6cc1355a9790@fjl.co.uk>

index | next in thread | previous in thread | raw e-mail

On 12/09/2025 08:58, Frank Leonhardt wrote:
> This is a reply to several including Bob, Sad and Kyle.
> 
> TLDR: The methods and syntax I was using are fine on GNU sed but
> BSD sed appears to require a newline and there's no way around it.
Presuming you're working with sh or bash (as opposed to {t,}csh) and
it's having an actual newline that's annoying, you can always use sh's
dollar single quote strings. Then you get the alternate annoyance of
backslash doubling instead.

sed  -i.bak  -e $'/Line 2/a\\\nNew Line' example.txt

-- 
Vibe coding - the technical debt of tomorrow.


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?ce6d67d5-83eb-44fb-a8bf-fbc0b00e77b7>