title: How to use vim substitution command with sed?
body: <p>I want to convert a file such as ...</p>
  
  <pre><code>X,Y,id,
  7.6245541,51.9556144,4064462
  7.6248384,51.9556227,4064462
  7.6250697,51.9556376,4064462
  </code></pre>
  
  <p>... into the following format using regular expressions.</p>
  
  <pre><code>X,Y,id,
  "lat" : 7.6245541, "lon" : 51.9556144,
  "lat" : 7.6248384, "lon" : 51.9556227,
  "lat" : 7.6250697, "lon" : 51.9556376,
  "lat" : 7.6256435, "lon" : 51.9557072,
  </code></pre>
  
  <p>The following substitution command works perfect in vim:</p>
  
  <pre><code>:%s#\(\d*\.\d*\)\(,\)\(\d*\.\d*\)\(,\)\(\d*\)$#"lat" : \1\2 "lo" : \3\4#g
  </code></pre>
  
  <p>How can I use <em>sed</em> to do the same? I would be happy if I can used the extend expression mode (sed parameter <code>-r</code> to avoid escaping the round brackets). Here is what I tried:</p>
  
  <pre><code>sed -r 's#(\d*\.\d*)(,)(\d*\.\d*)(,)(\d*)$#"lat" : \1\2 "lo" : \3\4#gw output.csv' input.csv
  </code></pre>
  
  <p>The original content is printed to the shell and nothing has changed.</p>