Board logo

标题: [其他] 【已解决】批处理怎样实现多个内容同时筛选查找? [打印本页]

作者: chouxia    时间: 2015-7-2 08:23     标题: 【已解决】批处理怎样实现多个内容同时筛选查找?

本帖最后由 chouxia 于 2015-7-20 08:29 编辑
  1. curl www.baidu.com |find /i "ok" >nul
复制代码
用这个可以判断网页内容中是否有ok
errorlevel也正确
现在需要查找另外一段内容,需要在一行代码中实现!请问如何操作?
举例,在curl的回显中需要再find一个"none"
应该怎么操作?
作者: DAIC    时间: 2015-7-2 09:05

  1. curl www.baidu.com | findstr /i "ok none"
复制代码

作者: chouxia    时间: 2015-7-2 09:46

DAIC 发表于 2015-7-2 09:05



    我现在既需要ok的返回页需要none的返回啊
作者: DAIC    时间: 2015-7-2 16:41

回复 3# chouxia


    请把2楼代码的实际结果和你希望的结果分别发出来看看有何差异
作者: chouxia    时间: 2015-7-2 17:18

这个是curl的返回值
<pre class='xdebug-var-dump' dir='ltr'>
<b>array</b> <i>(size=2)</i>
  'hash' <font color='#888a85'>=&gt;</font> <small>string</small> <font color='#
cc0000'>'lj5Q5ofZG4z7ghrwTJHhIgiVIc5f'</font> <i>(length=28)</i>
  'key' <font color='#888a85'>=&gt;</font> <small>string</small> <font color='#c
c0000'>'lj5Q5ofZG4z7ghrwTJHhIgiVIc5f'</font> <i>(length=28)</i>
</pre>HTTP/1.1 100 Continue

HTTP/1.1 200 OK
Date: Thu, 02 Jul 2015 00:46:49 GMT
Server: Apache/2.4.9 (Win64) PHP/5.5.12
X-Powered-By: PHP/5.5.12
Set-Cookie: PHPSESSID=lutmp9i5ve5qsa32i78bopak53; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Content-Length: 73
Content-Type: text/html
error http://............
现在需要find HTTP/1.1 200 OK
还要find error http://.
作者: DAIC    时间: 2015-7-2 17:51

回复 5# chouxia
  1. curl www.baidu.com | findstr "OK error"
复制代码

作者: 会飞的蜗牛丶    时间: 2015-7-8 16:28

我今儿也在玩CURL, 你是要取CURL的HTTP状态码么




欢迎光临 批处理之家 (http://www.bathome.net/) Powered by Discuz! 7.2