Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The number of users who repeatedly visit the website within 2 days, subject to the number of IP

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

Shulou(Shulou.com)06/01 Report--

I saw the command comm today and explained that the same part of the two files can be compared.

Then, I intercepted the total IP of each day on March 2 and 3, 2016, and stored it in a separate file named log02,log03.

I have removed the repetition of the intercepted IP and sorted it, because the comm command requires that the files have been sorted

Execute the following command

# comm log02 log03-1-2 Note: this command means to withdraw the same parts of these two files

After using this command, I am always prompted that I need to sort the files, but I have already sorted them, so it is very strange that the data is not correct.

According to the nature of our website, it must be wrong to repeat IP so little every day, so I want to write a script to judge the IP that is repeated in 2 days.

Script content: according to the following script, it is easy to calculate how many repeated IP visits to our website in 2 days, very satisfied

#! / bin/bash

Log1= `cat log02`

Log2= `cat log03`

Count=0

For an in $log1;do

For b in $log2;do

If [[$a = = $b]]; then

Echo "$a" > > / tmp/log/comm.txt

Let count++

Fi

Done

Done

Echo "$count"

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Network Security

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report