找回密码
 注册
搜索
[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
查看: 24302|回复: 2

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

[复制链接]
发表于 2018-7-15 14:19:56 | 显示全部楼层 |阅读模式
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
 楼主| 发表于 2018-7-15 18:19:00 | 显示全部楼层
是问题太简单了么...
发表于 2018-7-15 18:31:33 | 显示全部楼层

  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
复制代码
只适用于举例文本。

评分

参与人数 1PB +12 技术 +1 收起 理由
CrLf + 12 + 1 大佬

查看全部评分

您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|批处理之家 ( 渝ICP备10000708号 )

GMT+8, 2026-3-18 13:06 , Processed in 0.014232 second(s), 9 queries , File On.

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表