I have the following script which does what I want

```
<?php
$data = array();                // define array

exec('faxstat -s', $data, $ret);     // execute command, output is array
echo "<pre>";

if ($ret == 0) {                // check status code. if successful
    foreach ($data  as $line)  {  // process array line by line
    echo "$line \n";

    }
} else {
    echo "Error in command";    // if unsuccessful display error
}

echo "</pre>";
?>

```

FAXSTAT is a command used in hylafax for monitoring channel status.

Sample output is as follows:

```
Modem ttyIAX017 (+1.999.555.1212): Running and idle 
Modem ttyIAX018 (+1.999.555.1212): Running and idle 
Modem ttyIAX019 (+1.999.555.1212): Running and idle 
Modem ttyIAX020 (+1.999.555.1212): Running and idle 
Modem ttyIAX021 (+1.999.555.1212): Running and idle 

```

Now I want to modify `Modem ttyIAX017 (+1.999.555.1212)` with Channel 17.
I want to do the same for all the channels with respective channel number. Is there a way to do this. 

I have searched a lot on google but could not find anything relevant.

Please help.