tags:

views:

232

answers:

1

Hi I am using the below script to copy a text file contentfrom a client workstation to a text file . I need to do this operation for 500 + workstations. After executing the script from all workstations data is copying to a text file. upto this ok I listed below the script and result. but I need the specified lines or data from that text file from which file we cope the data. I provided the script , Reult and required result.

Script:

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

Result:

[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

I need the reult text should e like this.

A: 

I hope that I understand the question correctly. I believe that this is a batch file that will copy only the desired lines to the Shashi.txt file:

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
)
BlueBearr