There is a file listing.txt, and in it words of this kind:
слово 1 слово 2 .... слово 4444 слово 4445 I split it into list1.txt, list2.txt ... 400 lines each:
<?php $lines = file("listing.txt"); $fc = 1; $lc = 400; // по сколько строк в файле $fp = fopen("list1.txt", "a"); for ($i=0; $i<count($lines); $i++) { fwrite($fp, $lines[$i]); if ($i/$lc==floor($i/$lc) and $i!=0) { fclose($fp); $fc += 1; $fp = fopen("list".$fc.".txt", "a"); } } fclose($fp); ?> At the end of each file there is an empty line:
слово 1 слово 2 .... слово 399 слово 400 и тут пустая строка (401 строка) How to remove it by correcting this script?