Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBScript to Read Text File (TSM Opt Config File)

Status
Not open for further replies.

djtech2k

MIS
Jul 24, 2003
1,097
US
I am looking for a good text file reading script/function to read a TSM Opt Config file and pull out certain configuration items.

I was wondering if anyone here has written something like this before. If not, a solid text file read would be helpful.

I thought there was a good text file reader in the FAQ here, but I could not find it.
 
Not sure what TSM Opt Config files look like so I'm not sure how the data needs to be parsed. However, below is a simple loop to open and read a text file line by line.

Code:
set objFSO = CreateObject("Scripting.FileSystemObject")
set objFile = objFSO.OpenTextFile("C:\temp\tile.txt", 1. true, 0)

do while NOT objFile.AtEndOfStream
   strLine = objFile.ReadLine

   '
   'do stuff
   '
loop

-Geates

"Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live."
- Martin Golding

"There are seldom good technological solutions to behavioral problems."
- Ed Crowley, Exchange guru and technology curmudgeon
 
Thanks. I have written text file scraping before, but I was looking for something that may be written specifically for parsing a config file for items.

For example, the items in this config file will list the "tag" and then the data, e.g.

DOMAIN C: D:
LOG c:\temp\file.log

So I need to parse the file and grab the data for specific conofiguration items. I know I have seen some very nice samples that included the search and error checking. For example, there could be some config items that are duplicates or lines that are commented.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top