Board logo

标题: [文本处理] 批处理如何从网页源码中提取指定网址/链接? [打印本页]

作者: neverji    时间: 2012-12-20 11:30     标题: 批处理如何从网页源码中提取指定网址/链接?

本帖最后由 pcl_test 于 2016-9-13 23:59 编辑

网页其中一段源代码
..
..
...
theAds=new Array();
shu =196;
dot='';
theAds[0]='<tr bgcolor=\"#FFFF98\" onmouseover=javascript:this.bgColor=\'#FFFFFF\' onmouseout=javascript:this.bgColor=\'#FFFF98\'><TD width=120> <a href=http://www.618n.com target="_blank"><font color=#000000>〓1.78复古〓</font></a></TD><TD width=101><a href=http://www.618n.com target="_blank">〓长期稳定耐玩〓</a></TD><TD class=font_R width=150>12月/20日/11点开放</TD><TD align=center width=80>经典复古合击</TD><TD>◢█◣复古1.78雷霆极品合击◢█◣-<font color=#ff0000>推荐</font></TD><TD width=120>客服QQ:①切装备全爆</TD><TD align=center width=56><a href=http://www.618n.com target="_blank">点击查看</a></TD></tr>';
.....
....

现在需要提取<a href=http://www.618n.com target="_blank"> 中的网址http://www.618n.com

需要怎么做  谢谢了
作者: BAT-VBS    时间: 2012-12-20 13:03

  1. grep -o "http://[a-z0-9.]*.com" a.txt
复制代码

作者: neverji    时间: 2012-12-20 13:12

回复 2# BAT-VBS


    谢谢哈
作者: tmplinshi    时间: 2012-12-20 15:22

  1. geturls < a.txt
复制代码
geturls 下载地址: http://bathome.net/thread-10581-1-1.html
作者: CrLf    时间: 2012-12-21 09:55

  1. @echo off
  2. for /f "delims=" %%a in (test.htm) do (
  3.    for %%b in (%%a) do (
  4.       for /f delims^=^" %%c in ("%%b") do echo %%c
  5.    )
  6. )
  7. pause
复制代码





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