$max = 1000000000 - 500000000;
$file_str = array();
$page = 1;
$page_count = 1000000;
for( $i = 0; $i < $max; $i++ )
{
$key = skip32_encode( $i );
$str = $i.':'.$key."\n";
$file_name = $key % 10000;
if( !isset( $file_str[ $file_name ] ) )
{
$file_str[ $file_name ] = "";
unset( $key, $str );
if( $i > ( 3000000000 + $page * $page_count ) )
{
$page++;
foreach( $file_str as $key => $value )
{
file_put_contents( "/data/work/lzz/niu4/tmp/skip32/{$key}.log", $value, FILE_APPEND );
unset( $file_str[ $key ], $key, $value );
}
clearstatcache( true );
unset( $file_str );
$file_str = array();
}
}
echo "结束了";
$file_str = array();
$page = 1;
$page_count = 1000000;
for( $i = 0; $i < $max; $i++ )
{
$key = skip32_encode( $i );
$str = $i.':'.$key."\n";
$file_name = $key % 10000;
if( !isset( $file_str[ $file_name ] ) )
{
$file_str[ $file_name ] = "";
}
//将结果保存到大小1000000的数组中,然后一次性写入文件中
$file_str[ $file_name ] .= $str;unset( $key, $str );
if( $i > ( 3000000000 + $page * $page_count ) )
{
$page++;
foreach( $file_str as $key => $value )
{
file_put_contents( "/data/work/lzz/niu4/tmp/skip32/{$key}.log", $value, FILE_APPEND );
unset( $file_str[ $key ], $key, $value );
}
clearstatcache( true );
unset( $file_str );
$file_str = array();
}
}
echo "结束了";
exit();
在skip32目录下运行 ls | xargs cat | awk -F ':' '{print $2}' | uniq -d 这样就可以判断是否有重复的了