I have records with two words of variable length, and I want to pad the
second word plus a separator after it to a fixed length, like so:

  first second          -> first second:      more
  first secondword      -> first secondword:  more
  firstword second      -> firstword second:      more
  firstword secondwd    -> firstword secondwd:    more

In this exact scenario, knowing the number of words before the separator
and knowing my second word won't overrun the space, I can pad the second
word and then play games with CHANGE:

  ... | specs w1 1 w2 nw.11 'more' nw | change w2.2 ' ': ' 1 | ...

Otherwise, I'd build the middle section of the record separately:

  (end /) ...
    | dup: fanout
    | specs <left piece here>
    | all: gather
    | join 2
    | ...
    / dup:
    | specs w2 1 ':' n '' 13
    | all:
    / dup:
    | specs <right piece here>
    | all:

Am I overlooking a more straightforward way?

¬R

Reply via email to