我試圖從wget的結果中提取一行,但遇到問題。 這是我的wget電話:從wget解析http響應標頭
$ wget -SO- -T 1 -t 1 http://myurl.com:15000/myhtml.html
輸出:
--18:24:12-- http://xxx.xxxx.xxxx:15000/myhtml.html => `-' Resolving xxx.xxxx.xxxx... xxx.xxxx.xxxx Connecting to xxx.xxxx.xxxx|xxx.xxxx.xxxx|:15000... connected. HTTP request sent, awaiting response... HTTP/1.1 302 Found Date: Tue, 18 Nov 2008 23:24:12 GMT Server: IBM_HTTP_Server Expires: Thu, 01 Dec 1994 16:00:00 GMT Location: https://xxx.xxxx.xxxx/siteminderagent/... Content-Length: 508 Keep-Alive: timeout=10, max=100 Connection: Keep-Alive Content-Type: text/html; charset=iso-8859-1 Location: https://xxx.xxxx.xxxx//siteminderagent/... --18:24:13-- https://xxx.xxxx.xxxx/siteminderagent/... => `-' Resolving xxx.xxxx.xxxx... failed: Name or service not known.
如果我這樣做:
$ wget -SO- -T 1 -t 1 http://myurl.com:15000/myhtml.html | egrep -i "302" <br/>
它不回我,包含字符串行。我只想檢查網站或網站管理員是否已啓動。
對@ Piotr的答案有很好的額外細節。 – 2008-11-19 15:24:07