title: bash grep finding java declarations
body: <p>i have a huge .java file and i want to find all declared objects given the className. i think the declaration will always have the following signature:</p>
  
  <p>className objName;  </p>
  
  <p>or </p>
  
  <p>className objName = </p>
  
  <p>or  </p>
  
  <p>className objName=</p>
  
  <p>can someone suggest me a grep pattern which will find these signatures. I have the following (incomplete)  :</p>
  
  <pre><code>    cat $rootFile | grep "$className " 
  </code></pre>
  
  <p>EXAMPLE :</p>
  
  <p>If the input file is :</p>
  
  <pre><code>Policy pol1;
  Policy pol2 ;
  Policy   pol3  ;
  Policy pol4=new Policy();
  Policy pol5 = new Policy();
  Policy pol6= new Policy();
  </code></pre>
  
  <p>I want to extract the following list :</p>
  
  <pre><code>pol1
  pol2
  pol3
  pol4
  pol5
  pol6
  </code></pre>