Re: Insert the content of a file (with command r?)
Paolo Bonzini <[email protected]>
| Newsgroups | gmane.editors.sed.user |
|---|---|
| Message-ID | <[email protected]> |
Il 25/07/2012 11:57, Laurent Le Brun ha scritto: >> > I'd like to insert the content of a file when the input matches some regexp. >> > It tried this simple script: /regexp/r file.txt >> > It works fine, except that it's inserting the content of the file >> > after the line matching the regexp. I'd like to insert it BEFORE >> > instead. > Thanks for the replies! > I've just found a solution by accident: > /regexp/e cat file.txt > > Documentation is not very clear here: "If a parameter is specified, > instead, the e command interprets it as a command and sends its output > to the output stream (like r does)." > (http://www.gnu.org/software/sed/manual/sed.html#Extended-Commands) > There's a difference, as r sends the output at the end of a cycle, > while e sends it immediately. Thanks, this is a documentation bug. I'll fix it. Paolo