title: How do I execute the same command on all lines contained in a error file of Vim?
body: <p>Scenario: I've run a static code analysis tool on my sources which found an issue on lots of my files.</p>
  
  <p>The issue is that the statement</p>
  
  <pre><code>*retval = -1;
  </code></pre>
  
  <p>needs to be replaced by</p>
  
  <pre><code>if(retval != NULL)
  {
      *retval = -1;
  }
  </code></pre>
  
  <p>I already managed to have all relevant places in an <a href="http://vimdoc.sourceforge.net/htmldoc/options.html#%27errorfile%27" rel="nofollow">errorfile</a> and started with the cycle</p>
  
  <ul>
  <li><a href="http://vimdoc.sourceforge.net/htmldoc/quickfix.html#%3acn" rel="nofollow"><code>:cn</code></a></li>
  <li>fix the code </li>
  <li><a href="http://vimdoc.sourceforge.net/htmldoc/quickfix.html#%3acn" rel="nofollow"><code>:cn</code></a></li>
  </ul>
  
  <p>This workflow does it but I've got 400 places to touch, so it's a bit boring.</p>
  
  <p>Could I instruct Vim (similar like for example <a href="http://vimdoc.sourceforge.net/htmldoc/windows.html#%3abufdo" rel="nofollow"><code>bufdo</code></a>) to correct the statement on all the places that are present in the errorfile?</p>
  
  <p>And no, simply opening all the files and <a href="http://vimdoc.sourceforge.net/htmldoc/windows.html#%3abufdo" rel="nofollow"><code>bufdo</code></a> then is not an option since the construct <code>*retval = -1;</code> occurs several times but only needs to be fixed on the lines contained in the errorfile.</p>