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: 526
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 replace the same words in text files with different strings? (46%)
How to merge two or more csv files with different columns into one file? (44%)
How to search hundreds of xml files for a list of numbers, find out which file contains which number? (44%)
How to randomly replace one line from line 7 to line 10 with the same numbers of -? (43%)
How to delete a list of files from a directory and subdirectories? (43%)

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