Read a text file and print pre-defined html when specific keywords are found
I'll give you a hint. Try using a foreach loop:
http://www.php.net/manual/en/control-structures.foreach.php

You can store all your files and associated information in an associative array, such as:

$files = array(
  0 =&gt; array(
    'filename' =&gt; "export_file_system_status_output";   
    'status_update' =&gt; "online";
  ),
  1 =&gt; array(
    'filename' =&gt; "another_file";   
    'status_update' =&gt; "offline";
  )
);


You should really try this on your own :) If you don't get it, I'll give you a more complete answer :)

On a side note, your HTML is not valid. Use classes instead of ids when possible, and use quotes:

&lt;div class="badge_subpage_system"&gt;
  &lt;h5&gt;#performancedegradation&lt;/h5&gt;
  &lt;p&gt;Performance is slower than normal.&lt;/p&gt;
&lt;/div&gt;


Hope this helps :)

EDIT:

Here's what your final code will look like, with the array I posted above:

foreach($files as $file)
{
  $handle = fopen($file['filename'], "r");
  $file = fread($handle,filesize($file['filename']));
  if (preg_match('#' . $file['status_update'] . '#', $file, $match))
  {
    echo '&lt;div id="badge_subpage_system"&gt;&lt;h5&gt;#performancedegradation&lt;/h5&gt;&lt;p&gt;Performance is slower than normal.&lt;/p&gt;&lt;/div&gt;';
  }
}