例1:
root@server:/home/karinto# curl --head --silent www.baidu.com > baidu //响应报文头部输入到baidu文件中 root@server:/home/karinto# cat baidu HTTP/1.1 200 OK Accept-Ranges: bytes Cache-Control: private, no-cache, no-store, proxy-revalidate, no-transform Connection: keep-alive Content-Length: 277 Content-Type: text/html Date: Fri, 10 Mar 2023 09:23:47 GMT Etag: "575e1f59-115" Last-Modified: Mon, 13 Jun 2016 02:50:01 GMT Pragma: no-cache Server: bfe/1.0.8.18 root@server:/home/karinto# curl --head --silent www.baidu.com | grep --ignore-case content-length //--ignore-case 忽略大小写 Content-Length: 277 root@server:/home/karinto# curl --head --silent www.baidu.com | grep --ignore-case content-length | cut --delimiter=' ' -f1 //以' '字符为分割点, 截取第一段 Content-Length: root@server:/home/karinto# curl --head --silent www.baidu.com | grep --ignore-case content-length | cut --delimiter=' ' -f2 //截取第二段 277
例2:待更新
root@server:/home/karinto# curl --head --silent www.baidu.com > baidu #响应报文头部输入到baidu文件中
* 本篇注释用//代替
标签:baidu,Shell,示例,--,server,管道,home,karinto,root From: https://www.cnblogs.com/karinto/p/17204231.html