title: How to find functions in a cpp file that contain a specific word
body: <p>using grep, vim's grep, or another unix shell command, I'd like to find the functions in a large cpp file that contain a specific word in their body. </p>
  
  <p>In the files that I'm working with the word I'm looking for is on an indented line, the corresponding function header is the first line above the indented line that starts at position 0 and is not a '{'.</p>
  
  <p>For example searching for JOHN_DOE in the following code snippet </p>
  
  <pre><code>int foo ( int arg1 ) 
  {
      /// code 
  }
  void bar ( std::string arg2  )
  {
      /// code
      aFunctionCall( JOHN_DOE );
      /// more code
  }
  </code></pre>
  
  <p>should give me </p>
  
  <pre><code>void bar ( std::string arg2  )
  </code></pre>
  
  <p>The algorithm that I hope to catch in grep/vim/unix shell scripts would probably best use the indentation and formatting assumptions, rather than attempting to parse C/C++.</p>
  
  <p>Thanks for your suggestions.</p>