Add new line between specific two lines

Kingston 256mb module for dell poweredge...
July 28, 2009 at 23:13:54
Specs: Windows XP
appreciate your support to guide me how to add a new line under [ORAGTWY] using vbs the file as follows;

; Settings for 25-User-SqlBase Server
[dbnt25sv]
country=germany
cache=2000
sortcache=2000
readonly=0
oracleouterjoin=0
logfileprealloc=0
partitions=0
optimizerlevel=2
locktimeout=275

[dbnt25sv.dll]
comdll=sqlws32
comdll=sqlapipe

[win32client]
country=germany
clientname=Win32User
SetZeroLengthStringsToNull=ON

[win32client.dll]
comdll=sqlws32
comdll=sqlora32
comdll=sqlodb32

[win32client.ws32]
serverpath=SRVxxx,<localhost>/WCxxx

[ORAGTWY]
REMOTEDBNAME=pos401a1,@pos401a1
REMOTEDBNAME=posprd2,@posprd2
REMOTEDBNAME=bscsprd2,@bscsprd2
REMOTEDBNAME=BSCSPRE7,@BSCSPRE7
REMOTEDBNAME=BSCSPRE7,@BSCSPRE7
REMOTEDBNAME=SIEBPRD2,@SIEBPRD2


servername=server1
REMOTEDBNAME=WCDB,@WCDB

[ODBCRTR]

[SQLTALK]
country=germany

[SQLAPIW]
country=germany


See More: Add new line between specific two lines

Report •


#1
July 29, 2009 at 01:57:07
This should be posted in the Programmers forum... link is on the right of this page.

http://ewen.uuuq.com/


Report •

#2
August 19, 2009 at 13:11:37
VB Script, and I can't believe you posted the same thing 3 times under different titles, Instead of figuring out how to re-word your question, maybe you should have done some Googling to find the code you wanted. Did you know that Microsoft tech net tells you how you needed to accomplish this task with VBScript?

strNewLine = "New Line to Write"
strFileName = "c:\test.ini"
strCheckForString = UCase("[ORAGTWY]")

Set objFS = CreateObject("Scripting.FileSystemObject")
StrContents = Split(objFS.OpenTextFile(strFileName).ReadAll, vbNewLine)
Set objTS = objFS.OpenTextFile(strFileName, 2)
For Each strLine In StrContents
If (Left(UCase(LTrim(strLine)),Len(strCheckForString)) = strCheckForString) Then
objTS.WriteLine strLine: objTS.WriteLine strNewLine
else
objTS.WriteLine strLine
End If
Next
Wscript.quit


Report •

Related Solutions


Ask Question