Option Explicit Dim LogData() As Variant Dim NyLogData() As Variant Private Sub Command1_Click() Call hent End Sub Public Sub hent() Dim Str As String, I As Long I = 0 Open "C:\log.txt" For Input As #1 Do ReDim Preserve LogData(I) Line Input #1, LogData(I) I = I + 1
Loop Until EOF(1) Close #1
Call Filbehandling
Open "C:\NYlog.txt" For Output As #1 For I = 0 To UBound(NyLogData)
Print #1, NyLogData(I) Next Close #1
End Sub
Public Sub Filbehandling() Dim P As Long, I As Long, Str As Variant, Navn As String, Ip As String, X As Long, A As Integer Dim Ws As String, Note As String, OK As Boolean, MidStr() As Variant, GK As String, G As Integer GK = Chr(34) & Chr(44) & Chr(34)
On Error Resume Next For I = 1 To UBound(LogData) LogData(I) = LTrim(LogData(I)) Next P = 0 For I = 0 To UBound(LogData) OK = False If Left(LogData(I), 1) = "-" Then GoTo Slettes If I > 0 Then If Left(LogData(I - 1), 1) = "-" And Left(LogData(I + 1), 1) = "-" Then Str = Split(LogData(I), "(") Navn = Str(0) Ip = Left(Str(1), Len(Str(1)) - 1) I = I + 1 GoTo Videre End If If Left(LogData(I), 1) = "*" Then Ws = LTrim(Right(LogData(I), Len(LogData(I)) - 1))
Else
Str = Split(LogData(I), " ") X = 0 For A = 0 To UBound(Str) If Str(A) <> "" Then ReDim Preserve MidStr(X) MidStr(X) = Str(A) X = X + 1 End If Next
If UBound(MidStr) = 2 Then Note = "" For A = 0 To UBound(MidStr) Note = Note & MidStr(A) & Chr(34) & Chr(44) Next Note = Left(Note, Len(Note) - 1) OK = True GoTo Videre Else
Note = "" For A = 0 To UBound(MidStr) - 2 Note = Note & MidStr(A) & " " G = A + 1 Next Note = Note & GK For A = G To UBound(MidStr) Note = Note & MidStr(A) & GK Next OK = True Note = Left(Note, Len(Note) - 2) End If End If End If Videre: If OK = True Then ReDim Preserve NyLogData(P) NyLogData(P) = Chr(34) & Date & GK & Navn & GK & Ip & GK & Ws & GK & Note 'List1.AddItem Chr(34) & Date & GK & Navn & GK & Ip & GK & Ws & GK & Note P = P + 1 End If
Global NyLogData() As Variant Global LogData() As Variant Public Sub hent() Dim Str As String, I As Long I = 0 Open "C:\log.txt" For Input As #1 Do ReDim Preserve LogData(I) Line Input #1, LogData(I) I = I + 1
Loop Until EOF(1) Close #1
Call Filbehandling
Open "C:\NYlog.txt" For Output As #1 For I = 0 To UBound(NyLogData)
Print #1, NyLogData(I) Next Close #1
End Sub
Public Sub Filbehandling() Dim P As Long, I As Long, Str As Variant, Navn As String, Ip As String Dim Ws As String, Note As String, OK As Boolean, MidStr() As Variant gk = Chr(34) & Chr(44) & Chr(34)
On Error Resume Next For I = 1 To UBound(LogData) LogData(I) = LTrim(LogData(I)) Next P = 0 For I = 0 To UBound(LogData) OK = False If Left(LogData(I), 1) = "-" Then GoTo Slettes If I > 0 Then If Left(LogData(I - 1), 1) = "-" And Left(LogData(I + 1), 1) = "-" Then Str = Split(LogData(I), "(") Navn = Str(0) Ip = Left(Str(1), Len(Str(1)) - 1) I = I + 1 GoTo Videre End If If Left(LogData(I), 1) = "*" Then Ws = LTrim(Right(LogData(I), Len(LogData(I)) - 1))
Else
Str = Split(LogData(I), " ") X = 0 For A = 0 To UBound(Str) If Str(A) <> "" Then ReDim Preserve MidStr(X) MidStr(X) = Str(A) X = X + 1 End If Next
If UBound(MidStr) = 2 Then Note = "" For A = 0 To UBound(MidStr) Note = Note & MidStr(A) & Chr(34) & Chr(44) Next Note = Left(Note, Len(Note) - 1) OK = True GoTo Videre Else
Note = "" For A = 0 To UBound(MidStr) - 2 Note = Note & MidStr(A) & " " G = A + 1 Next Note = Note & gk For A = G To UBound(MidStr) Note = Note & MidStr(A) & gk Next OK = True Note = Left(Note, Len(Note) - 2) End If End If End If Videre: If OK = True Then ReDim Preserve NyLogData(P) NyLogData(P) = Chr(34) & Date & gk & Navn & gk & Ip & gk & Ws & gk & Note P = P + 1 End If
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.