如何在Linux中从whois命令中剪切字符串

时间:2017-05-10 10:03:52

标签: php linux centos whois

如何在CentOS Linux上使用PHP从whois命令剪切字符串?

我只想从Domain Name:行切换到>>>Last update...<<<行。

我的代码:

<?php
$output = shell_exec('whois facebook.com');
$result = preg_split('/\n\n/', trim($output));
var_dump($result);
?>

1 个答案:

答案 0 :(得分:0)

如何使用sed

whois facebook.com | sed -n '/^Domain names/,/^>>> Last update/p'

这将获得以Domain names开头的行与以>>> Last update开头的行之间的所有行

相关问题