Having trouble with a script that I received from EE (script is attached). Worked in test but having problems using a file from production (see attached). Line 18 (company name starts with R4) and line 22 (starts with Coastal) have CR's in the street address and they are not getting removed (output file also attached).
Expert had asked if every record will begin with "AC-". I don't see that anywhere in the code. Is it using that approach somehow or not relying on the text at the beginning of each line?
' Define needed constants
Const ForReading = 1
Const ForWriting = 2
Const TriStateUseDefault = -2
' Get input file name from command line parm, if 2 parms entered
' use second as new output file, else rewrite to input file
If (WScript.Arguments.Count > 0) Then
sInfile = WScript.Arguments(0)
WScript.Echo "No filename specified."
If (WScript.Arguments.Count > 1) Then
sOutfile = WScript.Arguments(1)
sOutfile = sInfile
' Create file system object
Set oFSO = CreateObject("Scripting.FileSystemObject")
' Read entire input file into a variable and close it
Set oInfile = oFSO.OpenTextFile(sInfile, ForReading, False, TriStateUseDefault)
sData = oInfile.ReadAll
Set oInfile = Nothing
' Replace desired strings
Set oRegExp = New RegExp
oRegExp.Global = True
oRegExp.IgnoreCase = False
oRegExp.Pattern = "("".*)(\n)(.*"")"
sData = oRegExp.Replace(sData, "$1 $3")
' Write file with any changes made
Set oOutfile = oFSO.OpenTextFile(sOutfile, ForWriting, True)
Set oOutfile = Nothing
' Cleanup and end
Set oFSO = Nothing
' MsgBox "Conversion done."