中国DOS联盟论坛

中国DOS联盟

-- 联合DOS 推动DOS 发展DOS --

联盟域名:www.cn-dos.net  论坛域名:www.cn-dos.net/forum
DOS,代表着自由开放与发展,我们努力起来,学习FreeDOS和Linux的自由开放与GNU精神,共同创造和发展美好的自由与GNU GPL世界吧!

游客:  注册 | 登录 | 命令行 | 会员 | 搜索 | 上传 | 帮助 »
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » 如何筛选包含特定代码的文件
作者:
标题: 如何筛选包含特定代码的文件 上一主题 | 下一主题
zhouxiaohuanv
初级用户





积分 87
发帖 29
注册 2007-3-31
状态 离线
『楼 主』:  如何筛选包含特定代码的文件

在D:\sab\data\的所以TXT文件中如果有下面代码的就把他文件剪切到D:\trim文件夹中!
","","","","9","","",

[ Last edited by bjsh on 2007-5-10 at 07:32 PM ]

   此帖被 -2 点积分    点击查看详情   
评分人:【 bjsh 分数: -2  时间:2007-5-10 19:32


2007-5-10 15:58
查看资料  发送邮件  发短消息 网志   编辑帖子  回复  引用回复
zhoushijay
高级用户

Autowalk


积分 845
发帖 375
注册 2007-3-3
状态 离线
『第 2 楼』:  

你是指 ","","","","9","","", 整个字符串还是指分号里面的

2007-5-10 17:16
查看资料  发送邮件  发短消息 网志   编辑帖子  回复  引用回复
zhouxiaohuanv
初级用户





积分 87
发帖 29
注册 2007-3-31
状态 离线
『第 3 楼』:  整个字符串

整个字符串

2007-5-10 19:22
查看资料  发送邮件  发短消息 网志   编辑帖子  回复  引用回复
lxmxn
版主




积分 11386
发帖 4938
注册 2006-7-23
状态 离线
『第 4 楼』:  

在命令行中输入
findstr /smrc:"\",\"\",\"\",\"\",\"9\",\"\",\"\"," D:\sab\data\*.txt
再根据得到的文件来处理吧。

由于被搜索字符串的特殊性,很难将结果导入文件或者用批处理脚本来写(我试了不下几十遍,均不成功),只能用findstr找出文件来。如果哪位达人可以批量处理这个问题的,不妨把具体方案放出来一起研究一下。

2007-5-10 23:49
查看资料  发送邮件  发短消息 网志   编辑帖子  回复  引用回复
zhouxiaohuanv
初级用户





积分 87
发帖 29
注册 2007-3-31
状态 离线
『第 5 楼』:  文件的情况是这样的

文件一就是想找出来的 ","","","","9","","","


"2VBSF0CNW00","","","","","4122300-SFJ7-W9-YR239L","","","","9","","","09/05/2007 18:34:36","010","172","","0","0","1","0","0","0","","0","","0","","0","","0","","0","000000","0","999999999999","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""


文件二
"2VBSF0CKJ00","","","","","4122300-SFJ7-W9-YR239L","","E07HF0CJV00","","9","","","09/05/2007 12:50:03","010","172","","0","0","1","0","0","0","","0","","0","","0","","0","","0","000000","0","999999999999","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","2"
他们的不同就在一文件","","","","9","","","
第二个文件","","E07HF0CJV00","","9","","","
E07HF0CJV00是可以变化的~

2007-5-11 11:10
查看资料  发送邮件  发短消息 网志   编辑帖子  回复  引用回复
lxmxn
版主




积分 11386
发帖 4938
注册 2006-7-23
状态 离线
『第 6 楼』:  用grep试试

Re zhouxiaohuanv:
grep -no "4122300-SFJ7-W9-YR239L.*09/05/2007" *.txt


2007-5-11 17:54
查看资料  发送邮件  发短消息 网志   编辑帖子  回复  引用回复

请注意:您目前尚未注册或登录,请您注册登录以使用论坛的各项功能,例如发表和回复帖子等。


可打印版本 | 推荐给朋友 | 订阅主题 | 收藏主题



论坛跳转: