我使用以下脚本将文本文件内容从客户端工作站复制到文本文件。我需要为500多个工作站执行此操作。从所有工作站执行脚本后,数据将复制到文本文件。直到这个我在脚本和结果下面列出了。但是我需要来自该文本文件的指定行或数据,我们处理数据的文件。 我提供了剧本,Reult和所需的结果。
脚本:
copy "\\cg002009\c$\Documents and Settings\All Users\Application Data\IBM\LUM\I4LS.INI" c:\asd\mul.txt
echo cg002009 >> c:\asd\Shashi.txt
type c:\asd\mul.txt >> c:\asd\Shashi.txt
结果:
[iFOR/LS Machine-Configuration]
NCSCell=333b91c50000.0d.00.00.87.84.00.00.00
GroupName=DefaultGroupName
DebugProc=no
DebugNCS=no
DebugToFile=no
DebugToPath=C:\ifor\ls\conf
ConcurrentNodelock=No
LogLevel=1
LogMsgsMaxNum=1000
LogFile=C:\ifor\ls\conf\i4conmgr.log
CommunVersion=V4R5
RuntimeVersion=V4R5
NCSSupportVersion=V4R5
Communication=yes
NamespaceBindingSupport=no
AdvancedConfiguration=no
WindowCFGX=0
WindowCFGY=0
WindowCFGW=1152
WindowCFGH=720
WindowX=-4
WindowY=-4
WindowWidth=1288
WindowHeight=774
[iFOR/LS GLBD-Configuration]
Create=new
CreateFrom=
Family=ip
DefaultCell=yes
SelfClean=yes
Frequency=180
Timeout=long
[iFOR/LS LMD]
BackupMode=daily
BackupParm=0
BackupPath=C:\ifor\ls\conf\backup
NumberOfLogFile=2
MaxLogFileSize=10
ValidityPeriod=15
HALFrequency=30
[iFOR/LS NCS-Server]
llbd=no
glbd=no
ipPort=1515
ipGDBPort=10999
ipHALPort=11999
ipNDLPort=12999
ipAuthPort=
RunGLBD=no
RunGDB=no
DisableRemoteAdmin=no
DisableRemoteNdlAdmin=yes
LogAllEvents=no
LogFile=C:\ifor\ls\conf\logdb
LogPath=C:\ifor\ls\conf
ColdStart=no
DCEDWAITTIME=20
RunNDL=no
RunLMD=no
UseHostTable=no
PassiveTime=300
TraceActivities=no
MaxActivities=1024
MaxActivitiesThreshold=90
CleanStart=no
[iFOR/LS Server Logging]
LogGrant=no
LogCheckin=no
LogWait=no
LogVendor=yes
LogProduct=yes
LogTimeout=no
LogErrors=yes
LogVendorMsg=yes
LogSvrStartStopThr=no
[iFor/LS NetBios-Configuration]
LanAdaptor=0
NCBS=
HasOS2Clients=no
[iFOR/LS Metering Agent]
GDBRefreshFreq=5
LicCheckFreq=15
ProcPollFreq=10
ShowWindow=0
[iFOR/LS Client]
InstallDir=C:\ifor
RunMeteringAgent=no
Threshold_Automatic=0
Threshold_Frequency=60
Threshold_Level=80
Refresh_Automatic=0
Refresh_Frequency=60
ReadTimeout=4
Cleanup_Automatic=no
[iFOR/LS NCS-Client]
UseDirectBindingOnly=yes
GDBServer=not found
FilterNDL=No
FilterNet=No
NumDirectBindServers=7
NumDirectBindNDLServers=0
DirectBindServer1=ip:svlic01[1515]
OS2NetbiosServer1=no
DirectBindServer2=ip:svlic02[1515]
OS2NetbiosServer2=no
DirectBindServer3=ip:wsdrw02[1515]
OS2NetbiosServer3=no
DirectBindServer4=ip:100.120.10.7[1515]
OS2NetbiosServer4=no
DirectBindServer5=ip:100.120.6.97[1515]
OS2NetbiosServer5=no
DirectBindServer6=ip:100.120.160.201[1515]
OS2NetbiosServer6=no
DirectBindServer7=ip:100.120.1.2[1515]
OS2NetbiosServer7=no
required result:
NumDirectBindServers=7
NumDirectBindNDLServers=0
DirectBindServer1=ip:svlic01[1515]
OS2NetbiosServer1=no
DirectBindServer2=ip:svlic02[1515]
OS2NetbiosServer2=no
DirectBindServer3=ip:wsdrw02[1515]
OS2NetbiosServer3=no
DirectBindServer4=ip:100.120.10.7[1515]
OS2NetbiosServer4=no
DirectBindServer5=ip:100.120.6.97[1515]
OS2NetbiosServer5=no
DirectBindServer6=ip:100.120.160.201[1515]
OS2NetbiosServer6=no
DirectBindServer7=ip:100.120.1.2[1515]
OS2NetbiosServer7=no
我需要reult文本应该是这样的。
答案 0 :(得分:0)
我希望我能正确理解这个问题。我相信这是一个批处理文件,它只将所需的行复制到Shashi.txt文件中:
SETLOCAL ENABLEDELAYEDEXPANSION
set _flag=No
for /f "tokens=1,* delims==" %%a in (C:\asd\mul.txt) do (
If "!_flag!"=="Yes" echo %%a=%%b>>C:\asd\Shashi.txt
if "%%a"=="FilterNet" set _flag=Yes
)