Re: Stripping!!!
| From: | Robin Vickery | Date: | Thu, 11 Jan 2001 16:13:36 +0000 |
| Subject: | Re: Stripping!!! | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-34032@lists.php.net to get a copy of this message | ||
>>>>> "S" == "K Simon" <phpsoft@zabia.net> writes:
> Thx, but could anybody give me an example? It shouldnt be too hard?!
If you feel you have to do it in php then this should work. You'd save
a lot of effort if you used the unix 'cut' command though.
cut -d ' ' -f 1 inputfile.txt > outputfile.txt
is equivalent to (but considerably faster than) this:
<?php
$in_file = fopen( "inputfile.txt", "r" ) or die( "failed to open input
file." );
$out_file = fopen( "outputfile.txt", "w" ) or die( "failed to open output
file." );
while ( !feof($in_file) ) {
fwrite( $out_file, strtok(fgets($in_file, 1024), " ") . "\n");
}
fclose ($in_file);
fclose ($out_file);
?>
--
Still nothing