title: Convert regex positive look ahead to sed operation
body: <p>I would like to sed to find and replace every occurrence of <code>-</code> with <code>_</code> but only before the first occurrence of <code>=</code> on every line.</p>
  <p>Here is a dataset to work with:</p>
  <pre><code>ke-y_0-1=&quot;foo&quot;
  key_two=&quot;bar&quot;
  key_03-three=&quot;baz-jazz-mazz&quot;
  key-=&quot;rax_foo&quot;
  key-05-five=&quot;craz-&quot;
  </code></pre>
  <p>In the end the dataset should look like this:</p>
  <pre><code>ke_y_0_1=&quot;foo&quot;
  key_two=&quot;bar&quot;
  key_03_three=&quot;baz-jazz-mazz&quot;
  key_=&quot;rax_foo&quot;
  key_05_five=&quot;craz-&quot;
  </code></pre>
  <p>I found this regex will match properly.</p>
  <pre><code>\-(?=.*=)
  </code></pre>
  <p>However the regex uses positive lookaheads and it appears that <code>sed</code> (even with <code>-E</code>, <code>-e</code> or <code>-r</code>) dose not know how to work with positive lookaheads.</p>
  <p>I tried the following but keep getting <code>Invalid preceding regular expression</code></p>
  <pre><code>cat dataset.txt | sed -r &quot;s/-(?=.*=)/_/g&quot;
  </code></pre>
  <p>Is it possible to convert this in a usable way with sed?</p>
  <p>Note, I do not want to use perl. However I am open to awk.</p>