?
Solved

Trying to input a file with no separators

Posted on 2003-03-02
2
Medium Priority
?
117 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…
Suggested Courses
Course of the Month14 days, 3 hours left to enroll

800 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