<?php
$file=file("dosya.txt");
foreach($file as $satir)
{
$str=explode(",",$satir);
$yaz = fopen ("dosya2.txt", 'a+');
fwrite($yaz, " ".$str[0]."\n");
fclose ($yaz);
}
?>Çıkış:xxx;yyy
xxx;yyy
xxx;yyy
xxx;yyy
xxx;yyy
xxx;yyy
xxx;yyy
şeklinde olur.