GNU bug report logs -
#36201
Inserting files with r *before* the address
Previous Next
To reply to this bug, email your comments to 36201 AT debbugs.gnu.org.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-sed <at> gnu.org:
bug#36201; Package
sed.
(Thu, 13 Jun 2019 23:54:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Dan Jacobson <jidanni <at> jidanni.org>:
New bug report received and forwarded. Copy sent to
bug-sed <at> gnu.org.
(Thu, 13 Jun 2019 23:54:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
/bla/r filename is great, but do document how to insert the file
*before* /bla/, not only just after it.
Information forwarded
to
bug-sed <at> gnu.org:
bug#36201; Package
sed.
(Sat, 29 Jun 2019 08:28:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 36201 <at> debbugs.gnu.org (full text, mbox):
tag 36201 moreinfo
stop
Hello,
On Thu, Jun 13, 2019 at 07:36:37PM +0800, Dan Jacobson wrote:
> /bla/r filename is great, but do document how to insert the file
> *before* /bla/, not only just after it.
Off the top of my head, I can't think of a built-in way to insert a file
before an address (am I missing something?).
One could probably come up with some incantation using multiline
commands (D/G/H/N/P):
https://www.gnu.org/software/sed/manual/sed.html#Multiline-techniques
But I think this one is easier using gawk:
$ echo FOO > bar
$ seq 5 \
| gawk '/5/ { while ((getline tmp < "bar")>0) { print tmp } } ; 1'
1
2
3
4
FOO
5
Or are you asking for a new feature of inserting a file before an
address?
regards,
- assaf
Added tag(s) moreinfo.
Request was from
Assaf Gordon <assafgordon <at> gmail.com>
to
control <at> debbugs.gnu.org.
(Sat, 29 Jun 2019 08:28:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-sed <at> gnu.org:
bug#36201; Package
sed.
(Sat, 29 Jun 2019 14:36:02 GMT)
Full text and
rfc822 format available.
Message #13 received at 36201 <at> debbugs.gnu.org (full text, mbox):
>>>>> "AG" == Assaf Gordon <assafgordon <at> gmail.com> writes:
AG> Off the top of my head, I can't think of a built-in way to insert a file
AG> before an address (am I missing something?).
AG> One could probably come up with some incantation using multiline
AG> commands (D/G/H/N/P):
AG> https://www.gnu.org/software/sed/manual/sed.html#Multiline-techniques
OK maybe at the r documentation say "The reader is welcome to add a recipe for adding
a file before the line (like i vs. a)." Else folks will wonder that
nobody thought of it.
AG> But I think this one is easier using gawk:
No fair using gawk. We're talking about sed.
AG> Or are you asking for a new feature of inserting a file before an
AG> address?
I think no more features should be added to sed as there is perl...
This bug report was last modified 6 years and 53 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.