Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Trying to input a file with no separators

Posted on 2003-03-02
2
Medium Priority
?
119 Views
Last Modified: 2010-08-05
I'm trying to input a file. It's actually a unix log file which I want to parse and produce output on a Windoze computer. I'm using VB and my problem is that there aren't any separators between the log file sections... ie it gives something like this:

14595541.155 92 172.17.1.2 TCP_DENIED 72 http://badwebsite.com

(all on one line)

and there may be anything from 1 to 1000 of these lines. Because there aren't any separators (ie , ; " ') between the sections and I want to get each separate section like:

UnixtimeStamp = 14595541.155
random Data = 92
IPAddress = 172.17.1.2
Outcome = TCP_DENIED
random data = 72


Is there any way I can input this file? It's just a text file basically :-s

Thanks in advance,

Andrew
0
Comment
Question by:andrewrn
2 Comments
 
LVL 28

Accepted Solution

by:
vinnyd79 earned 150 total points
ID: 8051650
if you are using vb6 and there is a space seperating the data you need,then try using the split function:

Private Sub Command1_Click()
Dim sStr As String
Dim arrSt() As String
Dim i As Integer
sStr = "14595541.155 92 172.17.1.2 TCP_DENIED 72 http://badwebsite.com"
arrSt = Split(sStr, " ")
For i = 0 To UBound(arrSt)
MsgBox arrSt(i)
Next i

End Sub
0
 

Author Comment

by:andrewrn
ID: 8052148
Just worked it out myself too but thanks for the help.
Am basically building a Squid log file analyser for my School (I'm a pupil)

Thanks
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

564 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question