|
Prev: VBS network install Script
Next: active x control
From: nnanna on 26 May 2005 19:04 nnanna wrote: > *SAMPLE FILE IS:* > > 13301794560(a)133SH.COM > 13301794560(a)133SH.COM > 2205171(a)MCIMAIL.COM > 35988869625(a)SMS.MTEL.NET > > *DESIRED RESULT: > > 133sh.com > MCIMAIL.COM > sms.mtel.net > > When I use the [B]Right* function to get the strings right of "@" it > doesn't give me the desired result, the *Left* function does > give strings right of "@". Any ideas? > > CODE > > '############################################################################################## > '############################################## > > 'Textfile to read > sInpFile = "C:\WindowsScripts\vbscript\ExcelList\ListItems.txt" > > 'Result file > sResultFile = "C:\WindowsScripts\vbscript\ExcelList\clean.txt" > > 'Character to search > strInput = "@" > > ' FileSystemObject.CreateTextFile > Const OverwriteIfExist = -1 > Const FailIfExist = 0 > > ' FileSystemObject.OpenTextFile > > Const FailIfNotExist = 0 > Const ForReading = 1 > Const ForAppending = 8 > > > > Set oFSO = CreateObject("Scripting.FileSystemObject") > > ' Get list item names into an array: > Set f = oFSO.OpenTextFile (sInpFile,ForReading, FailIfNotExist, > OpenAsASCII) > > > > > Dim aListitem() > i = 0 > Do Until f.AtEndOfStream > sLine = Trim(f.ReadLine) > If Not sLine = "" Then > ReDim Preserve aListitem(i) > aListitem(i) = sLine > i = i + 1 > End If > Loop > f.Close > > ' Loop through the listitem array > > > ' Create result file > Set fOutputFile = oFSO.CreateTextFile(sResultFile,OverwriteIfExist, > OpenAsASCII) > > > > For Each sItem In aListitem > > kline = instr(sItem,strInput) > pline = left(sItem,kline) > fOutputFile.WriteLine pline > kline = 0 > > Next > 'fOutputFile.close > > wscript.echo "Process Complete" [/B] Never mind guys....I figured it out -- nnanna ------------------------------------------------------------------------ Posted via http://www.codecomments.com ------------------------------------------------------------------------
|
Pages: 1 Prev: VBS network install Script Next: active x control |