Replace Pioneer Home   All Examples   Free Download

 New request --free  RSS: Replace Pioneer Examples

199.Count and statistics -- Is it easy to analyze web logs and provide a sorted list of visiting numbers of different countries?

User: editor -- 2008-06-23          << 198  200 >>
Hits: 2033
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


Similar Examples:
How to replace one content of same files with different contents ? (50%)
How to find out the top 5 largest and distinct numbers in a text file? (48%)
How to batch rename files by moving the leading numbers to the end? (48%)
How to put a list of names in different rows into one line? (47%)
How to merge columns of 2 files with the same name in different folder? (46%)
How to replace the same words in text files with different strings? (46%)
How to batch rename files by removing all trailing numbers? (44%)
How to replace certain column from different files?  (44%)

Check Demo of Count and statistics
Keywords:
ddd  logs  odd  dictionary  diction  desc  last word  tea  toc  dic  text operations  count dictionary  last numbers  replace end word beginning  replace operations  count list word text  word count list  word sort and count