From nobody Fri Sep 12 11:22:36 2025 X-Original-To: freebsd-questions@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4cNX8j5yk1z67KKt for ; Fri, 12 Sep 2025 11:22:45 +0000 (UTC) (envelope-from freebsd@qeng-ho.org) Received: from mailout.qeng-ho.org (mailout.qeng-ho.org [217.155.128.244]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4cNX8j3gjrz3YgW for ; Fri, 12 Sep 2025 11:22:45 +0000 (UTC) (envelope-from freebsd@qeng-ho.org) Authentication-Results: mx1.freebsd.org; none Received: from [172.23.1.2] (arthur.home.qeng-ho.org [172.23.1.2]) by mailout.qeng-ho.org (Postfix) with ESMTP id 99E1515AE07; Fri, 12 Sep 2025 12:22:37 +0100 (BST) Message-ID: Date: Fri, 12 Sep 2025 10:22:36 -0100 List-Id: User questions List-Archive: https://lists.freebsd.org/archives/freebsd-questions List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: freebsd-questions@freebsd.org Sender: owner-freebsd-questions@FreeBSD.org MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [List] Re: Nice easy sed question To: Frank Leonhardt , freebsd-questions@freebsd.org References: <20250911221857100915167@bob.proulx.com> <4c223de1-6ed0-4f56-9b50-6cc1355a9790@fjl.co.uk> Content-Language: en-GB From: Arthur Chance In-Reply-To: <4c223de1-6ed0-4f56-9b50-6cc1355a9790@fjl.co.uk> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:13037, ipnet:217.155.0.0/16, country:GB] X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Rspamd-Queue-Id: 4cNX8j3gjrz3YgW 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.