2009-10-27 41 views
0

我正在使用以下腳本將文本文件內容從客戶端工作站複製到文本文件。我需要爲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

請重新格式化的問題,所以我們都可以閱讀更加舒適 – 2009-10-27 14:59:42

+0

和重寫,所以我們都可以理解什麼你在詢問 – 2009-10-27 15:00:30

+0

試試這個命令:>>>>>>幫助findstr – 2009-10-27 15:01:42

回答

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 
) 
相關問題