error_reporting(0);
echo"\n"."输入要整理的文件:"."\n";
$dic=trim(fgets(STDIN));
$file=file($dic);
$array=preg_replace('/($\s*$)|(^\s*^)/m','',$file); //消除空行
$new_array=array_values(array_unique($array));//消除重复行
$new_filename="new_". basename($dic); www.2cto.com
if(file_put_contents("$new_filename",join("\r\n",$new_array))){
echo"------------------------------------------"."\r\n";
echo"\n"."去除重复完毕!"."\r\n" ;
echo"去除重复后的文件为:"."\r\n";
echo dirname(__FILE__).DIRECTORY_SEPARATOR."$new_filename"."\r\n";
echo"------------------------------------------"."\r\n";
}
else{
echo"------------------------------------------"."\r\n";
echo"错误!"."\r\n";
echo"找不到文件!请检查输入路径是否存在!"."\r\n";
echo"------------------------------------------"."\r\n";
exit();
}
?>
摘自 http://hi.baidu.com/nginxshel

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

Zend Studio 13.0.1
Powerful PHP integrated development environment

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

SublimeText3 Mac version
God-level code editing software (SublimeText3)

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft