here is a sample code... it does it job (i hope!) but perhaps someone can optimize it:
<?php
$contents = file("filename.txt");
$output = "";
for($i = 0; $i < sizeof($contents); $i++) {
if($i != 0) {
$output .= ", ";
}
$output .= substr($contents[$i], 0, strpos($contents[$i], "~~"));
}
print $output; // will print "blah, blah, blah, ..."
?>
You may need to escape the ~ characters... not too sure :-)
-sridhar