Trying To Avoid Reading a File Twice
<p>I am parsing a text file that can be up to 35MB in size.  </p>

<p>I currently have this code:</p>

<pre><code>const string show_BLOCK_DELIMITER = "show ";
const string Show_BLOCK_DELIMITER = "Show ";
const string Begin_SHOW_HW_DELIMITER = @"show hardware internal errors";
</code></pre>

<p>and this logic that controls what to capture:</p>

<pre><code> if ((line == null) || (trimmed.StartsWith(show_BLOCK_DELIMITER))
  ||   (trimmed.StartsWith(Show_BLOCK_DELIMITER))  
|| (trimmed.Contains(Begin_SHOW_HW_DELIMITER)))
  {
     //stuff happens here
   }
</code></pre>

<p>The way I capture is read the file and when I hit a line that starts with 'show' or 'Show' I check it to see if it is what I want to capture. If so I start capturing until the next line that starts with 'show' or 'Show'.  The new code is supposed to capture stuff between the constant 'Begin_SHOW_HW_DELIMTER' except here is is a sample of the input.  What I should get is 2 blocks, or strings, each one starting with "Module-N#" Since those lines with fc-mac in them start with 'show' but aren't in the list of what I want to capture the code thinks it is a new block and they don't get captured.  At this point I am wondering about a separate method to handle this new part and just reading the file twice.  The if/else statements are already pretty convoluted. </p>

<p>module-1# show hardware internal errors</p>

<p><code>show hardware internal fc-mac port 1 interrupt-counts</code></p>

<p><code>show hardware internal fc-mac port 2 interrupt-counts</code></p>

<p>module-2# show hardware internal errors</p>

<p><code>show hardware internal fc-mac port 1 interrupt-counts</code></p>

<p><code>show hardware internal fc-mac port 2 interrupt-counts</code></p>
