если правильно понял то вот:
PHP код:
<?php
$file = trim(@$argv[1]);
if (!file_exists($file)) die("file \"$file\" not found\n");
$fp = fopen($file, 'r');
$fpOut = fopen("out_$file", 'w');
while (!feof($fp))
{
$line = trim(fgets($fp));
if (!$line) continue;
$arr = explode(" ", $line);
shuffle($arr);
fwrite($fpOut, join(" ", $arr) . "\n");
}
fclose($fpOut);
fclose($fp);
файл для теста был:
a1 a2 a3
b1 b2 b3
c1 c2 c3
на выходе:
a1 a3 a2
b1 b2 b3
c1 c3 c2