[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#36201: Inserting files with r *before* the address
From: |
Assaf Gordon |
Subject: |
bug#36201: Inserting files with r *before* the address |
Date: |
Sat, 29 Jun 2019 02:27:10 -0600 |
User-agent: |
Mutt/1.11.4 (2019-03-13) |
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