如何从 whois
中剪切一个字符串在 CentOS Linux 上使用 PHP 命令?
我只想从Domain Name:
中剪下来行到 >>>Last update...<<<
行。
我的代码:
<?php
$output = shell_exec('whois facebook.com');
$result = preg_split('/\n\n/', trim($output));
var_dump($result);
?>
最佳答案
如何使用 sed
:
whois facebook.com | sed -n '/^Domain names/,/^>>> Last update/p'
这将获取以 Domain names
开头的行和以 >>> Last update
开头的行之间的所有行
关于php - 如何在 Linux 中从 whois 命令中剪切字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43889282/