Replace Pioneer Home   All Examples   Free Download

 New request --free  RSS: Replace Pioneer Examples

574.Count and statistics -- How to count how many IP addresses with different classes from web logs?

User: editor -- 2010-07-27          << 573  575 >>
Hits: 2154
Type: Count and statistics   
Search all Count and statistics examples
Description:
How to count how many IP addresses with different classes from web logs? 
How to make statistics of weblogs, find out how many class A IP addresses, as well as class B,C,D,E 
Input Sample:
web log files: 
12.13.14.15 .... 
10.22.201.38 ... 
.... 
Output Sample:
A 81378 
B 5181 
C 23929
Answer:
Hint: You need to Download and install "Replace Pioneer" on windows platform to finish following steps.
There are following classes of IP addresses:  
Class A 1.0.0.1 to 126.255.255.254  
Class B 128.1.0.1 to 191.255.255.254  
Class C 192.0.1.1 to 223.255.254.254 
Class D 224.0.0.0 to 239.255.255.255 
Class E 240.0.0.0 to 254.255.255.254    
 
1. ctrl-o open source log file 
2. ctrl-h open replace window 
* in search for pattern, enter: 
 
* uncheck option of "Print Unmatched Unit" 
# click "Advanced" page, 
* in "run following at the beginning of replace", enter: 
 
in "run following for each matched unit", enter: 
 
* in "insert end text", enter: 
 
3. click "Replace", done!
Download Script:  scripts/574.rst.zip

Screenshot 1:  Replace_Window


Screenshot 2:  Replace_Advanced_Window


Similar Examples:
How to count how many IP addresses are appearing in  a text file? (64%)
How to count the number of Unique IP address from a web log file? (62%)
How to count and sort the occurrence of different numbers in a text file? (60%)
How to count the frequency of different words in website like cnn.com? (60%)
How to count how many characters in a web page? (59%)
How to count and sort the occurrance of different lines? (57%)
How to count the number of records for each month in a web log file? (57%)
How to extract email addresses from multiple webpages? (55%)

Check Demo of Count and statistics
Keywords:
ddd  blog  count how many ip addresses  101  logs  class  123  count how many  var  insert end text  find replace web page  insert beginning  insert text at beginning  beginning end  web page search replace  insert text end text  insert text end  replace text in web page