Ihor Radchenko <[email protected]> writes:
> Steve Holtz via "General discussions about Org-mode."
> <[email protected]> writes:
>
>> After sending I realized that there was an error in the code... Hyphens
>> needed replaced by underbars. My bad.... I made the change without
>> testing....
>>
>> The attached version has the fix - and has been tested.
Thanks for this, Steve!
A couple of thoughts and questions before we add it to the library:
> * Extract lines from output
Perhaps add "with sed".
You have added the new section at the end of the page, but I think it
can come earlier. The last couple of entries before it are not actual
LoB blocks but relevant Babel tips ("Available languages", "Default
result"). Since your block deals with passing values, perhaps it belongs
right before or right after the "Tables" section.
> To use this, name the source code block that will be generating the
> lines to extract from. Usually, this source code block will not export
> anything. So, it will look like this:
> #+name: source
> #+header: :results output :exports none
> #+begin_src ???
> ???
> #+end_src
As a non-working example, it should probably be in a BEGIN_EXAMPLE block
with `#+' lines comma-escaped, so it doesn't get ingested into the
Library of Babel.
But I'm just wondering: instead of the question marks, can we think of a
working minimal source block that does something it might make sense to
extract lines from?
> And the =line_str= variable must be passed the lines desired to
> extract using the =sed= syntax for
> [[https://www.gnu.org/software/sed/manual/sed.html#Range-Addresses][selecting
> by address ranges]]
> ([[https://www.gnu.org/software/sed/manual/sed.html#Numeric-Addresses][selecting
> by line numbers]] or by
> [[https://www.gnu.org/software/sed/manual/sed.html#Regexp-Addresses][text
> matching]] may work, but has not been tested by the author).
Is this the right way to put it? As I understand the sed manual,
'addresses' can be line numbers or regular expressions, and 'address
ranges' can be composed of both. The address ranges in your example CALL
line are composed of line-number pairs (and one single line number,
`7p'), so it seems fair to say that line numbers *have* been tested.
FWIW, I've tested text matching a bit and that seems to work fine, too.
> #+call: extract_lines(data=source(), line-str="1,2p;7p;14,16p") [...]
^
line_str
Regards,
Christian