|
3#
楼主 |
发表于 2013-9-15 21:26:51
|
只看该作者
本帖最后由 2010laocfan 于 2013-9-15 21:49 编辑
pznpt 发表于 2013-9-15 12:28
比如,某一行含有数字911,因911不在6~81范围,你肯定说这一行不提取。
比如,某一行含有数字911,因数 ...
谢谢回复!
这是一个MUI的注册表文件TT1.txt如下:
hklm,"SOFTWARE\Microsoft\Updates\Windows Server 2003\SP0\IE8-MUI\Filelist\0","FileName",,"ieakmmc.chm"
hklm,"SOFTWARE\Microsoft\Updates\Windows Server 2003\SP0\IE8-MUI\Filelist\0","Location",,"C:\WINDOWS\help\MUI\0804"
hklm,"SOFTWARE\Microsoft\Updates\Windows Server 2003\SP0\IE8-MUI\Filelist\1","FileName",,"ieeula.chm"
hklm,"SOFTWARE\Microsoft\Updates\Windows Server 2003\SP0\IE8-MUI\Filelist\1","Location",,"C:\WINDOWS\help\MUI\0804"
hklm,"SOFTWARE\Microsoft\Updates\Windows Server 2003\SP0\IE8-MUI\Filelist\10","FileName",,"jsdebuggeride.dll.mui"
hklm,"SOFTWARE\Microsoft\Updates\Windows Server 2003\SP0\IE8-MUI\Filelist\10","Version",,"8.0.6001.18702"
hklm,"SOFTWARE\Microsoft\Updates\Windows Server 2003\SP0\IE8-MUI\Filelist\10","Location",,"C:\Program Files\Internet Explorer\zh-cn"
hklm,"SOFTWARE\Microsoft\Updates\Windows Server 2003\SP0\IE8-MUI\Filelist\100","FileName",,"JSProfilerCore.dll.mui"
hklm,"SOFTWARE\Microsoft\Updates\Windows Server 2003\SP0\IE8-MUI\Filelist\100","Version",,"8.0.6001.18702"
hklm,"SOFTWARE\Microsoft\Updates\Windows Server 2003\SP0\IE8-MUI\Filelist\100","Location",,"C:\Program Files (x86)\Internet Explorer\zh-tw"
................
hklm,"SOFTWARE\Microsoft\Updates\Windows Server 2003\SP0\IE8-MUI\Filelist\901","FileName",,"wininet.dll.mui"
hklm,"SOFTWARE\Microsoft\Updates\Windows Server 2003\SP0\IE8-MUI\Filelist\901","Version",,"8.0.6001.18702"
hklm,"SOFTWARE\Microsoft\Updates\Windows Server 2003\SP0\IE8-MUI\Filelist\901","Location",,"C:\WINDOWS\SysWOW64\sv-se"
想从中提取zh-cn相关的所有行,百度一个批处理
@echo off
setlocal enabledelayedexpansion
cd.>b.txt
for /f "delims=" %%i in ('more TT1.txt^|findstr /i /c:"zh-cn"') do (
set "str=%%i"
set str=!str:"zh-cn"=!
echo !str!>>b.txt
)
只能得到b.txt如下:
hklm,"SOFTWARE\Microsoft\Updates\Windows Server 2003\SP0\IE8-MUI\Filelist\6","Location",,"C:\Program Files\Internet Explorer\zh-cn"
hklm,"SOFTWARE\Microsoft\Updates\Windows Server 2003\SP0\IE8-MUI\Filelist\7","Location",,"C:\Program Files\Internet Explorer\zh-cn"
hklm,"SOFTWARE\Microsoft\Updates\Windows Server 2003\SP0\IE8-MUI\Filelist\8","Location",,"C:\Program Files\Internet Explorer\zh-cn"
................
hklm,"SOFTWARE\Microsoft\Updates\Windows Server 2003\SP0\IE8-MUI\Filelist\81","Location",,"C:\WINDOWS\SysWOW64\zh-cn"
可知含“\6”-“\81”顺序的所有行是我所需,希望得到的结果是提取TT1.txt中含“\6”-“\81”顺序的所有行到一个新文件
手工提取太慢,由此想到该命题,如何循环嵌套还真不会 |
|