0

localhost.txthost.txtの 2 つのテキスト ファイルを取得しました。

localhost.txtには以下が含まれます。

127.0.0.1:100
127.0.0.1:200
127.0.0.1:300
127.0.0.1:400
127.0.0.1:500
127.0.0.1:600
127.0.0.1:700
127.0.0.1:800
127.0.0.1:(...)

host.txtには以下が含まれます。

172.39.32.1:100
172.39.32.1:200
172.39.32.1:300
172.39.32.1:400
172.39.32.1:500
172.39.32.1:600
172.39.32.1:700
172.39.32.1:800
127.0.0.1:1300
127.0.0.1:1800
172.39.32.1:(...)

(...) このスクリプトを使用しています

$data = file("localhost.txt");
file_put_contents('host.txt', implode(array_unique($data))); 
$fisier = file_get_contents('host.txt'); 

重複を削除します。

同様の行も削除するスクリプトが必要です。たとえば、localhost.txt の 127.0.0.1:200 が既に host.txt に存在する場合、スクリプトは 127.0.0.1 を含むすべての行を host.txt から削除します。

何か案は?:) ありがとう

4

1 に答える 1