Thread: vbscript help
View Single Post
Old 2008-11-10, 03:15   #2
starrynte
 
starrynte's Avatar
 
Oct 2008
California

23610 Posts
Default

i don't know vbscript, but some vague ideas on how i would do it in java is:
0. start from beginning of file
1. read the next character (in java it's actually: read the next byte, then cast it into a char, but thats not relevant)

assuming the possible "types" of lines are all included in your example,
Quote:
user=MyUserName is my Name
[2008/08/11 06:04:17]
305*2^587594-1 is not prime. Res64: D7E974A6678F50AD Time : 956.0 sec.
user=User Name 1
[2008/08/11 06:04:29]
301*2^587635-1 is prime! Time : 515.0 sec.
user=UserName2
[2008/08/11 06:04:34]
395*2^587644-1 is not prime. Res64: 64EDC1DAF0150DCD Time : 367.0 sec.
2. if the character is a u , go to step 3. if the character is a [ , go to step 4. else, go to step 5.
3. (this is a user line) continue reading until the character is = . print "The user is ". then, continue reading, but print the character on the same line as you read it. if the character is a new line, print it, then go back to step 1. go back to step 1
4. (this is a date line) continue reading, output the characters as read, except when the character read is ] . then, read the next character which should be a newline, and go back to step 1
5. (this is a result line. read characters, do what you want with it. when newline character is read, go back to step 1 if not end of file)

this can possibly be modified to fit vbs and your purposes, i don't know vbs so i can't look at your code
starrynte is offline   Reply With Quote