I have a file split into two sections, and I wanted to add a delimiter
in between them only when there were lines in both sections.  I puzzled
for a while about how to detect that both sections were present and my
complicated ideas with PREDSELECT or COUNT got more and more ridiculous.

Finally it hit me:  Just add a header to both sections conditionally,
and DROP whichever one comes first.

  (end /) ... | strliteral conditional | both: fanin | drop 1 | ...
        / ... | strliteral conditional '-between-' | both:

Nothing in the first file, delimiter gets dropped.
Nothing in the second file, delimiter isn't produced.

¬R

Reply via email to