回复 21# magelit272
本帖已由batman(威士)大师完美、胜利完成,完成了原创性的编写代码工作,处理两千多个.txt文件,深表感谢和衷心的祝贺
下面就是这历史性的原创代码,以batman大师的名字命名:- @echo off&setlocal enabledelayedexpansion
- del new*>nul 2>nul
- (for /f "delims=" %%a in ('dir /on /b *.txt') do (
- setlocal
- for /f "delims=" %%b in ('type %%a^&echo ◆结尾◆') do (
- if defined ok if not defined "%%b" echo,%%b&set "ok="&set ""%%b"=a"
- set "str=%%b"
- if "!str:☆曾用名=!" neq "!str!" set "bt=!str!"
- for %%c in ("◆控盘情况◆" "◆成交回报(单位:万元)◆" "◆ 大事提醒 ◆" "◆ 公司概况 ◆" "◆ 回顾展望 ◆" "◆结尾◆") do if "!str:%%~c=!" neq "!str!" set "flag="&set "str1="
- for %%c in ("◆最新消息◆" "◆概念题材◆" "◆ 行业新闻 ◆" "◆ 八面来风 ◆" "◆ 信息快讯 ◆") do (
- if "!str:%%~c=!" neq "!str!" set "flag=a"&set "bk=!str!"
- if "!str:◆ 回顾展望 ◆=!" neq "!str!" set "flag=a"&set "bk=!str! "
- )
- if defined flag (
- if "!str:2011-08-25=!" neq "!str!" if "!str!" neq "!bk!" set "str1=!str! "
- if defined str1 (
- if "!str:环比=!" neq "!str!" (
- for %%c in ("!bt!" "!bk!" "!str1!" "!var!" "!str!") do if not defined %%c echo %%~c&set "%%c=a"
- for %%c in (bt bk) do set "%%c="
- set "ok=a"
- )
- )
- )
- set "var=!str!"
- )
- endlocal&echo ----------------------------------------------------------------------
- ))>new
- move /y new new.txt
- start new.txt
复制代码 这个代码用于:股市关于万国测评的浩如烟海的f10资料的特别内容提取、合成以及自动打开。 |