On 7/24/2014 9:06 PM, Bob Cronin wrote:
>>From each input I need to generate "n" variants, where "n" equals the
> number of slashes.
> 
> For example, for a/b/c, I need to generate a/V/b/c and a/b/V/c.

I've done similar tasks by adding a pipeline with a CHANGE or INSERT for
each occurrence as I find it:

'addpipe *: | locate "/" | *.in:'  /* just records with slashes */
'peekto'
Do i = 2 while rc = 0

  'addpipe (end ?) *:'              , /* read input */
    '| next: fanout'                , /* copy below */
    '| insert ,V/, before fs / f' i , /* vary this field */
    '| out: faninany'               , /* add in output below */
    '| *:'                          , /* write output */
    '? next:'                       ,  /* copy from above */
    '| locate fs / f' i+1           ,  /* if next field exists */
    '| *.in:'                       ,  /* keep in input after variant */
    '? *.out:'                      , /* output from later commands */
    '| out:'                        , /* add to variant above */

  If rc = 0 then 'peekto'
End

¬R

Reply via email to