『楼 主』:
[求助](SED提取)RegexBuddy的表达式如何转写成SED的语法?
有以下一段代码
</script><title>阿凡达.Avatar.2009.BD.2Audio.MiniHD-TLF.part1.rar - 115网络U盘-我的网盘|免费网络硬盘</title></head><body onbeforeunload="try{MainBeforeUnload();}catch(e){}"> <div id="topbar"> <div class="nav" id="topbar_nav"><a href="http://115.com/s?">聚合搜索</a><a href="http://v.115.com/?">影视聚搜</a><strong>网络U盘</strong><a href="http://tool.115.com/">工具箱</a><a href="http://fav.115.com/">收藏夹</a><a href="http://wo.115.com/">我的小窝</a></div> <div id="topbar_login"><a href="http://u.115.com//?l&goto=http%3A%2F%2Fu.115.com%2F%3Fac%3Dmy" id="my_login">登录</a> | <a href="http://my.115.com/?action=register&goto=http%3A%2F%2Fu.115.com%2F%3Fac%3Dmy">免费注册</a></div> </div> <div id="header"> <div class="row"> <h1 class="logo"><a href="/" class="goto-home" title="115 网络U盘"><span>115 网络U盘</span><img src="http://u.115.com/static/images/logo_index.png" alt="115 网络U盘"/></a></h1><div id="top_menu"> <ul class="top-ul"> <li><a href="/" class="goto-home">首页</a></li> </ul> <ul class="top-ul"> <li><a href="http://u.115.com/"><span class="ico upload-top"> </span>上传文件</a></li> <li><a href="http://u.115.com/file/"><span class="ico pick"> </span>提取文件</a></li> </ul> <ul class="top-ul"> <li><a href="/download.html"><span class="ico egg-ico"> </span>优蛋下载</a></li> </ul> </div><div id="header_bar"> </div></div></div><div id="content" class="clearfix"> <div class="box"> <div class="box-header"> <h2 class="nowrap file-name rar">阿凡达.Avatar.2009.BD.2Audio.MiniHD-TLF.part1.rar</h2> </div> <div class="publicize" style="width:100%; height:90px;"> <iframe scrolling="no" src="http://u.115.com/static/modules/b.html" style="width:100%; height:90px;" frameborder="0"></iframe> </div> <div class="publicize" style="height:30px;"> <iframe scrolling="no" src="http://u.115.com/static/modules/g.html" style="width:100%; height:30px;" frameborder="0"></iframe> </div> <div class="box-inner"> <div class="row"> <div class="down-l"> <ul id="file_handle" class="share-bar"> <li><a class="tou" href="javascript://" onclick="Util.ScreenManager.Show(document.getElementById('complaint_box'));" title="问题投诉"><span>投诉</span></a></li> <li><a class="ju" href="javascript://" onclick="Util.ScreenManager.Show(document.getElementById('report_box'));"" title="举报本文件"><span>举报</span></a></li> </ul><table id="info_table" cellpadding="0" cellspacing="0" border="0"> <tr> <td width="200px;">文件大小:750MB</td> <td>提取码:t35e07b154</td> </tr> <tr> <td>上传时间:2010-04-25 21:47</td> <td>上传者:dka1688</td> </tr> </table> <table id="info_table2" cellpadding="0" cellspacing="0" border="0"> <tr> <td colspan="4">SHA1:15573750BF6B07D91638E0CF12BE4B459D27A87B <a href="http://www.xiazaiba.com/html/358.html" target="_blank">校验软件下载</a></td> </tr> </table><div id="down_list" class="clearfix"> <a class="normal-down" href="http://11.cnc.115cdn.com:8080/pickdown/M00/26/E3/d5Nq-UvUR4kAAAAALuAAACzdBM43460900/%E9%98%BF%E5%87%A1%E8%BE%BE.Avatar.2009.BD.2Audio.MiniHD-TLF.part1.rar?key=bc118f36966841636b2c6634674dacfc&key1=4c182dc4&file=%E9%98%BF%E5%87%A1%E8%BE%BE.Avatar.2009.BD.2Audio.MiniHD-TLF.part1.rar&key2=3230332e3132362e35362e36" onclick="sendMnvdToServer();" target="_blank"> 网通1下载 </a> <a class="normal-down" href="http://11.tel.115cdn.com:8080/pickdown/M00/26/E3/d5Nq-UvUR4kAAAAALuAAACzdBM43460900/%E9%98%BF%E5%87%A1%E8%BE%BE.Avatar.2009.BD.2Audio.MiniHD-TLF.part1.rar?key=7202d92362d1dd7814680ca69110f4a9&key1=4c182dc4&file=%E9%98%BF%E5%87%A1%E8%BE%BE.Avatar.2009.BD.2Audio.MiniHD-TLF.part1.rar&key2=3230332e3132362e35362e36" onclick="sendMnvdToServer();" target="_blank"> 电信1下载 </a> <a class="normal-down" href="http://11.bak.115cdn.com:8080/pickdown/7285214fb5739ab16a77acece4e5b6c54c1857f4/M00/26/E3/d5Nq-UvUR4kAAAAALuAAACzdBM43460900/%E9%98%BF%E5%87%A1%E8%BE%BE.Avatar.2009.BD.2Audio.MiniHD-TLF.part1.rar?file=%E9%98%BF%E5%87%A1%E8%BE%BE.Avatar.2009.BD.2Audio.MiniHD-TLF.part1.rar&key1=4c182dc4&key2=3230332e3132362e35362e36" onclick="sendMnvdToServer();" target="_blank"> 备份下载 </a> <div style='display:none'><img src='http://11.bak.115cdn.com:8080/stat/stat.gif' /></div> <a href="#" class="u-down" onclick="return AddDownTask('t35e07b154','','http://u.115.com/file/t35e07b154','阿凡达.Avatar.2009.BD.2Audio.MiniHD-TLF.part1.rar','15573750BF6B07D91638E0CF12BE4B459D27A87B')" >优蛋下载</a> </div><div id="down_list_info"> <a href="javascript://" id="save_btn" title="收藏到我的网盘" login="false"><img src="http://u.115.com/static/images/save.gif" alt="" /> 收藏到网盘</a> <p> 文件剩余有效时间:<strong id="time" class="red"><script>document.write(setDay(expire--))</script></strong> <script> 要提取出 (只要这个镜像的链接)
http://11.bak.115cdn.com:8080/pickdown/7285214fb5739ab16a77acece4e5b6c54c1857f4/M00/26/E3/d5Nq-UvUR4kAAAAALuAAACzdBM43460900/%E9%98%BF%E5%87%A1%E8%BE%BE.Avatar.2009.BD.2Audio.MiniHD-TLF.part1.rar?file=%E9%98%BF%E5%87%A1%E8%BE%BE.Avatar.2009.BD.2Audio.MiniHD-TLF.part1.rar&key1=4c182dc4&key2=3230332e3132362e35362e36 用RegexBuddy研究了一下,如下表达式可以匹配出结果(RegexBuddy测试成功,兼容语法为perl)
http://[0-9][0-9]\.bak\.115cdn\.com:8080/pickdown.*?(?=") 修改一下复制到cmd命令行中测试.
sed "/http:\/\/[0-9][0-9]\.bak\.115cdn\.com:8080\/pickdown.*?(?=")" text.htm 出现如下语法错误:
sed: -e expression #1, char 70: unterminated address regex 测试过的sed版本包括GNU sed version 4.1.5(含cygwin1.dll的版本) 和GNU sed version 4.2(gnuwin32.sourceforge.net版本,含pcre3.dll-Perl-compatible regular-expression library).
请问正确的语法应该怎样写? 如果上述表达式有sed不支持的参数,应该如何改写(或更好的写法)?
谢谢
[ Last edited by w524e on 2010-6-21 at 17:49 ]
|