User: editor -- 2008-06-23 << 198 200 >> |
Hits: 3533 |
Type: Count and statistics |
Search all Count and statistics examples |
Description: |
Is it easy to analyze web logs and provide a sorted list of visiting numbers of different countries? |
Input Sample: |
web page text logs containing many IP address. |
Output Sample: |
Country Name Number of visiting ================================ United States 12173 United Kingdom 6978 India 937 .... |
Answer: |
Hint: You need to Download and install "Replace Pioneer" on windows platform to finish following steps. |
1. ctrl-o open web log text file 2. ctrl-h open 'Replace' dialog in 'Replace' page: * set 'Search for pattern' to: * uncheck options of [ ]Print unmatched unit * set nothing in 'Replace with pattern' click 'Advanced' page: * set 'Run following at the beginning of replace' to: * set 'Run following for each matched unit' to: * set 'Insert end text' to: 3. click 'Replace', done! Note: get_value(), set_value() are dictionary operations, here we use it to count number of visiting of each country. sort_by_word(get_values_all(),-1,-1,"num","desc") means sort all the (country ,number) pair by the number, which is the last word(from word -1 to -1), "num" means sort by number instead of string, "desc" means sort by descendent order. |
Download Script: scripts/199.rst.zip |
Screenshot 1: Replace_Window |
Screenshot 2: Replace_Advanced_Window |