GNU bug report logs -
#36201
Inserting files with r *before* the address
Previous Next
Full log
View this message in rfc822 format
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
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.