<?xml version="1.0" encoding="windows-1252"?>
<node id="1006742" title="Re: perl substitue till found pattern in aline" created="2012-12-02 13:33:12" updated="2012-12-02 13:33:12">
<type id="11">
note</type>
<author id="840762">
rjt</author>
<data>
<field name="doctext">
&lt;c&gt;while (&lt;DATA&gt;) {
    s/ (?=.*\s?-1 )/,/g;
    print;
}

__DATA__
01 fines name 2222 -P sws -1 reee.tee rrt
02 fi si 2232 -P sqww -1 re.wqw ttf
02 fi si-1 2232 -P sqww -1 re.wqw ttf&lt;/c&gt;

&lt;p&gt;This will replace spaces with commas before the last -1 in the file.&lt;/p&gt;</field>
<field name="root_node">
1006740</field>
<field name="parent_node">
1006740</field>
</data>
</node>
