Clicky

here is what i do to read a large crushftp file . it  took me 2.5 hours to read only checking for the month  on the line
but since the days i am looking for all at the end i need some help to eiither read it backwords
or only copy a section of file from the back when i copy it over

How can I do it? or is there a better option
private Sub read_file_for_crush_logs()
        Try
            ' Create an instance of StreamReader to read from a file.
            ' The using statement also closes the StreamReader.
            Using sr As New StreamReader("c:\z_hold_files\crushFTP.log")
                Dim line As String
                ' Read and display lines from the file until the end of
                ' the file is reached.
                Do
                    line = sr.ReadLine()
                    If Not (line Is Nothing) Then
                        Console.WriteLine(line)
                    End If
                    Dim lString = LSet(line, 2)
                    If lString = "11" Then
                        Dim a As String
                        a = "BANNED IP CONNECTION TERMINATED"
                        Dim b As Boolean
                        Dim c As Integer
                        'Dim subString As String = Microsoft.VisualBasic.Left(line, 3)
                        Dim TestStrings As String = "BANNED IP CONNECTION TERMINATED"

                        c = System.String.Compare(a, line, b)

                        If c = 0 Then
                            MsgBox(a & " " & b, " " & c)
                        End If
                    End If
                Loop Until line Is Nothing
            End Using
        Catch e As Exception
            ' Let the user know what went wrong.
            Console.WriteLine("The file could not be read:")
            Console.WriteLine(e.Message)
        End Try
    End Sub

asked 11/22/2011 10:52

JMadden's gravatar image

JMadden ♦♦


3 Answers:
There is VB code to read a text file backwards here:
http://www.xtremedotnettalk.com/showthread.php?t=68964
link

answered

Alex_W's gravatar image

Alex_W

thanks i will give it a try
because of the holiday
i may not get to it before friday/saturday
but if it works you will get the points

john
link

answered 2011-11-23 at 07:19:18

JMadden's gravatar image

JMadden

alex

its not working
do you have another site  for me to look at?
link

answered 2011-11-23 at 08:42:47

JMadden's gravatar image

JMadden

Your answer
[hide preview]

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Tags:

Asked: 11/22/2011 10:52

Seen: 219 times

Last updated: 12/04/2011 09:47