sed-devel
[Top][All Lists]
Advanced

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

Edit in place, then print


From: Peter Kozich (GM)
Subject: Edit in place, then print
Date: Sun, 02 Feb 2025 23:59:03 +0100
User-agent: Evolution 3.54.3 (3.54.3-1.fc41)

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 use this:
$ sed --version
sed (GNU sed) 4.9
Copyright (C) 2022 Free Software Foundation, Inc.

$ uname -a
Linux gygv 6.12.11-200.fc41.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Jan 24
04:59:58 UTC 2025 x86_64 GNU/Linux


br
pk

 



reply via email to

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