sed-devel
[Top][All Lists]
Advanced

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

Re: Edit in place, then print


From: Arkadiusz Drabczyk
Subject: Re: Edit in place, then print
Date: Mon, 3 Feb 2025 18:14:21 +0100

On Sun, Feb 02, 2025 at 11:59:03PM +0100, Peter Kozich (GM) wrote:
> Could someone please help me by answering this:
> 
> I would expect that these two commands are equivalent:
> 
> sed -i -e '1i\\'     -e 'w/dev/stdout' file.txt
> sed -i -e '1s/^/\n/' -e 'w/dev/stdout' file.txt
> 
> The second one does what I wanted: inserts a blank line at the top of
> the file then prints the edited file.
> 
> The first one, however, inserts a blank line, but prints the original
> file, not the edited one.
> 
> Is my expectation wrong somehow or should I have sent this to the bug
> list?

I think the reason is that i does not add a line to the pattern space
like s does.

BTW, this list is very quiet, maintainers do not reply to any
messages.

-- 
Arkadiusz Drabczyk <arkadiusz@drabczyk.org>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]