title: Findstr:Batch to find String (all lines) between two fixed characters
body: <p><br>
  I am totally new to DOS. Infact I am a Java guy. I need to do some string search operations but unfortunately string search &amp; file search operation in java is considerably slow. And its very fast in OS.<br><br>
  So here is my problem. I need to search all files with fixed extension (.sp) for strings (all lines) between 2 fixed characters. They are ';' &amp; ';'<br><br>
  Here is the content of one of .sp file.
  File:- Tons.sp</p>
  
  <pre><code>line 1: Skipcheck;
  line 2: [Scenario:'Actual']=STET;
  line 3: ['WFS':'Actual','Scenario':'Actual','Measure':'Units']=N:
  line 4: IF( SUBST( !Measure, 1, 1) @= '8'
  line 5: ,
  line 6:     ['Amount']
  line 7: ,
  line 8:    STET
  line 9: );
  line10: 
  line11: ['Tons'] = N:
  line12: DB('Volume Master',!Version,!Year,!Plant,'GL_CODE_0004',!Period,!Measure) ;
  line13: 
  line14: ['Group1_Volume'] = N:
  line15: IF ( ELISANC( 'Plant', 'Group1' , !Plant )=1 
  line16:     , ['Take_This']
  line17:    , CONTINUE
  line18: );
  line19: 
  line20: ['Tons Trend']=N:
  line21: IF( DB('Monthly_Trend', !Period, 'Tons_Trend_Factor') &gt; 0
  line22: , 'Current_Tons' * DB('Volume Master',!Version,!Year,!Plant,'GL_CODE_TonsProduced',!Period,!Measure) 
  line23: , CONTINUE
  line24: );
  </code></pre>
  
  <p><em>Please Note: line numbers are just for indication.</em></p>
  
  <p><strong>Problem 1:</strong> Now I need to find the string (all lines) that lie between ';' &amp; ';' that contains string "DB('Volume Master'"
  ie.: The findstring will be something like this:- </p>
  
  <pre>
  FINDSTR /n "=*DB('Volume Master'*;" *.sp</pre>
  
  <p>The result of above command should be line 10 to 12  &amp; line 19 to 24</p>
  
  <pre><code>line10: 
  line11: ['Tons'] = N:
  line12: DB('Volume Master',!Version,!Year,!Plant,'GL_CODE_0004',!Period,!Measure) ;
  </code></pre>
  
  <p>&amp;</p>
  
  <pre><code>line19: 
  line20: ['Tons Trend']=N:
  line21: IF( DB('Monthly_Trend', !Period, 'Tons_Trend_Factor') &gt; 0
  line22: , 'Current_Tons' * DB('Volume Master',!Version,!Year,!Plant,'GL_CODE_TonsProduced',!Period,!Measure) 
  line23: , CONTINUE
  line24: );
  </code></pre>
  
  <p><br>
  <strong>Problem 2:</strong> The output of this:-</p>
  
  <pre>FINDSTR /n "=*DB('Volume Master'*'GL_CODE_TonsProduced'*;" *.sp</pre>
  
  <p>should be:-</p>
  
  <pre><code>line19: 
  line20: ['Tons Trend']=N:
  line21: IF( DB('Monthly_Trend', !Period, 'Tons_Trend_Factor') &gt; 0
  line22: , 'Current_Tons' * DB('Volume Master',!Version,!Year,!Plant,'GL_CODE_TonsProduced',!Period,!Measure) 
  line23: , CONTINUE
  line24: );
  </code></pre>
  
  <p>Please help. </p>
  
  <p>Thanks<br>
  Krishna</p>