Login | |
|
 |
RE: script to combine lines in txt file - 4/7/2008 12:38:24 PM
|
|
 |
|
| |
dm_4ever
Posts: 2641
Score: 46
Joined: 6/29/2006
From: Orange County, California
Status: offline
|
You don't compile VBScript...save the code into a text file, rename it to .vbs, and double click it. WScript.exe will execute the .vbs by default for the most part CScript.exe can be used to execute the script from the command line
_____________________________
dm_4ever My philosophy: K.I.S.S - Keep It Simple Stupid Read Me: http://www.visualbasicscript.com/m_24727/tm.htm Frequently Asked Stuff: http://www.visualbasicscript.com/m_47117/tm.htm
|
|
| |
|
|
|
 |
RE: script to combine lines in txt file - 4/7/2008 1:49:11 PM
|
|
 |
|
| |
chriswebb18
Posts: 71
Score: 0
Joined: 4/7/2008
Status: offline
|
ok so ive got it to open the input txt to read and able to create an output txt just fine. i know this isnt much but im still working and i am a noob. now i want to find a way to have it recognize lines starting with "REC" followed by an 8-digit number. ie "REC********" but im not sure if the * only represents one character or if it reps 0 or more characters. the lines starting rec... are new lines, where every thing else needs carriage returns/line breaks removed. if that doesnt make sense see my first post above. thanks again for any help ' VBScript source code dim filesys, filetxt Const ForReading = 1, ForWriting = 2, ForAppending = 8 Set filesys = CreateObject("Scripting.FileSystemObject") Set filetxt = filesys.OpenTextFile("c:\medctrin.txt", Forreading, True) dim filetxt2, getname, path Set filetxt2 = filesys.CreateTextFile("c:\medctr.txt", True) path = filesys.GetAbsolutePathName("c:\somefile.txt") getname = filesys.GetFileName(path) If filesys.FileExists(path) Then Response.Write ("Your file, '" & getname & "', has been created.") End If
|
|
| |
|
|
|
 |
RE: script to combine lines in txt file - 4/7/2008 2:03:23 PM
|
|
 |
|
| |
dm_4ever
Posts: 2641
Score: 46
Joined: 6/29/2006
From: Orange County, California
Status: offline
|
Looks like you're getting closer...one suggestion would be to change your regular expression pattern to "^REC\d{8}" Open your original for reading, open another file using the same OpenTextFile method for writing or appending, and add your lines to this file you opened for writing.
_____________________________
dm_4ever My philosophy: K.I.S.S - Keep It Simple Stupid Read Me: http://www.visualbasicscript.com/m_24727/tm.htm Frequently Asked Stuff: http://www.visualbasicscript.com/m_47117/tm.htm
|
|
| |
|
|
|
 |
RE: script to combine lines in txt file - 4/8/2008 1:06:30 PM
|
|
 |
|
| |
dm_4ever
Posts: 2641
Score: 46
Joined: 6/29/2006
From: Orange County, California
Status: offline
|
Why don't you post an example of what you're dealing with? In particular those lines that give you problems. Just enter bogus info where applicable.
_____________________________
dm_4ever My philosophy: K.I.S.S - Keep It Simple Stupid Read Me: http://www.visualbasicscript.com/m_24727/tm.htm Frequently Asked Stuff: http://www.visualbasicscript.com/m_47117/tm.htm
|
|
| |
|
|
|
|