Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8777577
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T19:18:31+00:00 2026-06-13T19:18:31+00:00

Sorry for my bad English. I have a log file from a Web server

  • 0

Sorry for my bad English.

I have a log file from a Web server with 120,000 lines.

Example of input file:

10.160.0.10;16.11.2011 12:56;/;-;”Mozilla/5.0 (Windows NT 5.1; rv:2.0) Gecko/20100101 Firefox/4.0″
10.160.0.100;14.11.2011 7:22;/;-;”Mozilla/5.0 (Windows NT 5.1; rv:2.0) Gecko/20100101 Firefox/4.0″
10.160.0.100;14.11.2011 10:45;/;-;”Mozilla/5.0 (Windows NT 5.1; rv:2.0) Gecko/20100101 Firefox/4.0″
10.160.0.100;14.11.2011 10:53;/;-;”Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0)”

I need to compare the IP address in the first line with IP in the second line
and at the same time
to compare the last box that contains the version of the web browser with version in the second line.
And second line with third line etc.

If first IP is same as second IP and together first version is same as second version
then add to the end of line info example #1 (that will be mean that it is first user)

If IP or version are different then add to the end of line #2 (second user).

It identifies users based on IP address and User-Agent field (based on different versions of a web browser).

Example of ouput file:

10.160.0.10;16.11.2011 12:56;/;-;”Mozilla/5.0 (Windows NT 5.1; rv:2.0) Gecko/20100101 Firefox/4.0″;#1
10.160.0.100;14.11.2011 7:22;/;-;”Mozilla/5.0 (Windows NT 5.1; rv:2.0) Gecko/20100101 Firefox/4.0″;#2
10.160.0.100;14.11.2011 10:45;/;-;”Mozilla/5.0 (Windows NT 5.1; rv:2.0) Gecko/20100101 Firefox/4.0″;#2
10.160.0.100;14.11.2011 10:53;/;-;”Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0)”;#3

Do you have any idea how to do this?

Which method to use?

Thank you for help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T19:18:32+00:00Added an answer on June 13, 2026 at 7:18 pm

    This is not complete nor anywhere near optimal, but is basically everything you need.

    List list = new ArrayList();
    Scanner in = new Scanner(file);
    while(in.hasNext()) {
        String line = in.nextLine();
        String[] splitLine = line.split(";",5);
        String identifier = splitLine[0] + splitLine[4];
        if(list.contains(identifier)) {
            line = line + " #" + (list.indexOf(identifier) + 1));
        }
        else {
            line = line + " #" + (list.size() + 1);
            list.add(identifier);
        }
        System.out.println(line);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Sorry for my bad english, i'm from Italy XD I have done frogger game
Sorry for my bad English. I'm from Germany and have some problems with parsing
Sorry for bad english and bad title! I have the table post id title
Sorry for my bad English. Just like what I asked. I have this class
First, sorry for my bad english, I'm French. Here the problem : I have
Sorry for my bad english i'm working to rtsp communicate program this RTSP server
Sorry for my bad English. I have two activity. called Act1 and Act2 Act2
first, sorry for the bad english. I have a test that submit a login
Sorry for my bad English. I have 2 projects. Project 1 is a MFC
First thanks for reading me and sorry for my bad english. I have the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.