[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖

[文本处理] 大佬们 问下 怎么批处理怎样提取 TXT 特定 网址??

txt 为html文件 改TXT
txt文件内容为:
</form>
<script src="data/cache/md5.js?r99" type="text/javascript" reload="1"></script>
</div>https://mall.baidu.com/index-13113.html
<div id="nv">https://mall.baidu.com/index-1363113.html
<img src="html/pic/new.gif" style="position:absolute;z-index:1001;margin-left:454px;margin-top:-3px;"> https://mall.baidu.com/index-13313.html
https://mall.qq.com/index-11113.html
https://mall.baidu.com/index-131213.html
www.sohu.com
www.weiku.com

大致就是以上的内容 有乱码 和一些 网址 我只要提取
https://mall.baidu.com/index-13313.html 我只要这种的网址到另一TXT,
https://mall.baidu.com/index-xxxx.html 这种的 xxx为随机。
不要这类域名网址https://mall.qq.com/index-11113.html    www.weiku.com

是问题太简单了么...

TOP

  1. @echo off
  2. (for /f "tokens=1,* delims=>" %%a in ('findstr "https://mall.baidu.com/index-" a.txt') do (
  3.     if "%%b"=="" (echo,%%a) else echo,%%b
  4. ))>b.txt
复制代码
只适用于举例文本。
1

评分人数

    • CrLf: 大佬PB + 12 技术 + 1
初学BAT,非专业。代码不适当之处还望前辈们多多指点。在此表示感谢!

TOP

返回列表