使用php从文本文件中提取关键字并放入特定的表格单元格

below is my html page using php fopen to pull a text file and output to two columns. I need to go further with this and pull "specific keywords" from the text file and put in a "specific" row cell. Lets say keyword "red" needs to go to cell row 1 and "blue" to cell row 2, etc, etc.

I know there are two table columns in this html to deal with but if someone can assist on just one column, I can figure out the 2nd column.

Maybe there is a better way of doing this than php would be great as well.

    <head>
    <title>Snapshots and Backups</title>
    </head>
    <body>

    <h2 style="font-family:tahoma;">Below are Nightly Snapshots & Tape Backups</h2>

    <h3 style="font-family:tahoma;">

    <p style="color:green; font-weight:bold">

    <table border="1" cellpadding="1" cellspacing="1" height="30" width="100%">
    <thead>
            <tr>
                    <th scope="col">

    <b>Nightly Snapshots</><br>
    <?php

    $f = fopen("./backups/serversnaps.txt", "r");

    // Read line by line until end of file
    while(!feof($f)) {
        echo fgets($f) . "<br />";
    }

    fclose($f);

    ?>

    </th>

    <th scope="col">

   <b>Tape Backups</b>

    <?php

    $f = fopen("./backups/servertape.txt", "r");

    // Read line by line until end of file
    while(!feof($f)) {
        echo fgets($f) . "<br />";
    }

    fclose($f);

    ?>

    </th>
    </tr>
    </thead>
    <tbody>
    </tbody>
    </table>

    </p>

    </h3>

    <h2 style="font-family:tahoma;">This is the End of File</h2>

    </p>
    </body>
    </html>