我试图从 wget 的结果中提取一行,但遇到了麻烦。这是我的 wget 调用:
$ wget -SO- -T 1 -t 1 http://myurl.com:15000/myhtml.html
输出:
--18:24:12-- http://xxx.xxxx.xxxx:15000/myhtml.html
=> `-'
正在解决 xxx.xxxx.xxxx... xxx.xxxx.xxxx
正在连接到 xxx.xxxx.xxxx|xxx.xxxx.xxxx|:15000... 已连接。
已发送 HTTP 请求,等待响应...
找到 HTTP/1.1 302
日期:格林威治标准时间 2008 年 11 月 18 日星期二 23:24:12
服务器:IBM_HTTP_Server
过期:1994 年 12 月 1 日星期四 16:00:00 GMT
位置:https://xxx.xxxx.xxxx/siteminderagent/...
内容长度:508
保活:超时=10,最大值=100
连接:保持活动
内容类型:文本/html;字符集=iso-8859-1
位置:https://xxx.xxxx.xxxx//siteminderagent/...
--18:24:13-- https://xxx.xxxx.xxxx/siteminderagent/...
=> `-'
解析 xxx.xxxx.xxxx... 失败:名称或服务未知。
如果我这样做:
$ wget -SO- -T 1 -t 1 http://myurl.com:15000/myhtml.html | egrep -i "302" <br/>
它不会返回包含字符串的行。我只想检查站点或站点管理员是否已启动。