标题:
[文本处理]
批处理怎么提取含指定字符的行及其下一行?
[打印本页]
作者:
sonewboy
时间:
2009-12-13 15:02
标题:
批处理怎么提取含指定字符的行及其下一行?
txt文件内容如下:
...........
<LI class=NO>6 </LI>
<LI class=team><SPAN class=team_1><SPAN class=count>[12]</SPAN> <A
href="
http://www.abc.com/pages/info/soccerdata/team_data.php?teamid=1174&stageid=4162&seasonid=0
"
target=_blank>三 班</A></SPAN><SPAN class=team_vs>VS</SPAN><SPAN
class=team_1><A
href="
http://www.abc.com/pages/info/soccerdata/team_data.php?teamid=803&stageid=4162&seasonid=0
"
target=_blank>高九班</A> <SPAN class=count>[06]</SPAN></SPAN> </LI>
<LI class=time>12-13 22:00 </LI>
<LI class=data><A
......
要求提取含有"?teamid=" 字符的行及其下一行, 实际不止两队.
提取结果如下:
href="
http://www.abc.com/pages/info/soccerdata/team_data.php?teamid=1174&stageid=4162&seasonid=0
"
target=_blank>三 班</A></SPAN><SPAN class=team_vs>VS</SPAN><SPAN
href="
http://www.abc.com/pages/info/soccerdata/team_data.php?teamid=803&stageid=4162&seasonid=0
"
target=_blank>高九班</A> <SPAN class=count>[06]</SPAN></SPAN> </LI>
......
其它行都删除,请问代码怎么写?
作者:
batman
时间:
2009-12-13 15:06
findstr "teamid target" a.txt,可参考下面的贴子:
http://bbs.bathome.net/thread-6674-1-1.html
[
本帖最后由 batman 于 2009-12-13 15:07 编辑
]
欢迎光临 批处理之家 (http://bbs.bathome.net/)
Powered by Discuz! 7.2