gpt4 book ai didi

http - 从 wget 解析 http 响应头

转载 作者:可可西里 更新时间:2023-11-01 15:10:16 29 4
gpt4 key购买 nike

我试图从 wget 的结果中提取一行,但遇到了问题。这是我的 wget 调用:

$ 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.xxxxConnecting 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-1Location: https://xxx.xxxx.xxxx//siteminderagent/...--18:24:13--  https://xxx.xxxx.xxxx/siteminderagent/...           => `-'Resolving xxx.xxxx.xxxx... failed: Name or service not known.

if I do this:

$ wget -SO- -T 1 -t 1 http://myurl.com:15000/myhtml.html | egrep -i "302" <br/>

它没有返回包含该字符串的行。我只想检查站点或站点管理员是否已启动。

最佳答案

您要查找的 wget 的输出写在 stderr 上。您必须重定向它:

$ wget -SO- -T 1 -t 1 http://myurl.com:15000/myhtml.html 2>&1 | egrep -i "302" 

关于http - 从 wget 解析 http 响应头,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/302195/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com