Results 1 to 2 of 2

Thread: Reading log

  1. #1
    Join Date
    Mar 2011
    Posts
    1
    Rep Power
    0

    Default Reading log

    I have a text file with a lot of line's with this build.

    10.1.1.77 - - [06/Jan/2011:07:55:36 1000] "GET /ELO/Language.do?language=Nl HTTP/1.0" 200 9584

    Now I need to read the different items :

    10.1.1.77 IP adres
    - possible user name
    - possible remote user
    [06/Jan/2011:07:55:36 1000] date and hour of the request
    "GET /ELO/Language.do?language=Nl HTTP/1.0" First line of the request
    200 State
    9584 Number of bytes

    Now I whas planning to read the file using a scanner to read line by line. But I have no idea how to use different delimiters. I have looked around and found something about the use of regex but I don't understand the use.

    Can anyone explain? Thx all

  2. #2
    ozzyman's Avatar
    ozzyman is offline Senior Member
    Join Date
    Mar 2011
    Location
    London, UK
    Posts
    797
    Blog Entries
    2
    Rep Power
    4

    Default

    Because you mentioned you looked around but couldn't find tutorials of regex - here is the official tutorial for you:

    Lesson: Regular Expressions (The Java™ Tutorials > Essential Classes)

    Don't worry it is pretty straight-forward.

Similar Threads

  1. Reading from File
    By eevaa in forum New To Java
    Replies: 4
    Last Post: 05-22-2010, 09:18 AM
  2. Reading a .doc file
    By ujjal.ruet in forum New To Java
    Replies: 1
    Last Post: 05-11-2010, 10:14 PM
  3. reading from a .txt
    By Flamespewer in forum New To Java
    Replies: 1
    Last Post: 09-14-2009, 09:35 AM
  4. Replies: 5
    Last Post: 08-21-2009, 12:03 PM
  5. Reading from csv file.plz help!!!!!!!!!!
    By sanjayksaini in forum New To Java
    Replies: 1
    Last Post: 12-19-2008, 08:41 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •