On 8/20/2015 11:18 AM, Mike Walter wrote:
> Thinking outside the box, the real comma of importance is always
> between two double-quotes, right? Ala: "Field1 data","Field 2 data,
> with a comma, and another comma","Field3 data","and so on"
> How about a simple stage: | CHANGE /","/"~"/
Not quite so simple, but: The commas you want to preserve will always
come after an *odd* number of double quotes. If you knew the maximum
number of fields, you could list all the even-numbered ones to change
them in--except, unfortunately, CHANGE only takes a list of ranges, not
inputRanges, so you can't do it quite this neatly:
... | change (fs " f2 f4 f6 f8 f10) /,/ x05
| change /"//
| xlate , 05 05 ,
| ...
But you can do it one field at a time and ADDPIPE more CHANGEs until
you've got 'em all, something like:
'addstream input q'
'addpipe (end ?) *: | q: locate /"/ | *.in.q:' ,
'? q: | out: faninany | xlate , 05 05 , | *.out:' ,
'? *.out: | out:'
'select input q'
'peekto'
Do While rc = 0
'addpipe (end ?) *: | change fs " f2 /,/ x05' ,
'| change /"// 2 | q: locate /"/ | *.in:' ,
'? q: | out: faninany | *: ? *.out: | out:'
If rc = 0 then 'peekto'
End
¬R