The number of users who repeatedly visit the website within 2 days, subject to the number of IP
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"