hi all,
I'm quite new to scripting and hoping you might be able to help out. I currently have a VB script which echos the last line of a csv file, the issue I have is I can't figure out how to echo the 2nd value after the comma:
1,2
3,4
5,6
My script currently will echo both values, any guidance would be much appreciated
I'm quite new to scripting and hoping you might be able to help out. I currently have a VB script which echos the last line of a csv file, the issue I have is I can't figure out how to echo the 2nd value after the comma:
1,2
3,4
5,6
My script currently will echo both values, any guidance would be much appreciated
Code:
Option Explicit
Dim oFSO, oRegEx, sFileName, sText, oMatches, number, comma
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oRegEx = CreateObject("VBScript.RegExp")
oRegEx.Multiline = True
oRegEx.Global = True
sFileName = "C:\pandora\faxmulti.csv"
sText = oFSO.OpenTextFile(sFileName, 1).ReadAll
oRegEx.Pattern = "^([^\s]+)$"
Set oMatches = oRegEx.Execute(sText)
Set number = oMatches(oMatches.Count - 1)
Wscript.Echo number