Replace Pioneer Home   All Examples   Free Download

 New request --free  RSS: Replace Pioneer Examples

144.Count and statistics -- Can I make statistics of each lines, tell how many times the digit of '1' to '5' are appeared?

User: editor -- 2008-05-22          << 143  145 >>
Hits: 2884
Type: Count and statistics   
Search all Count and statistics examples
Description:
Can I make statistics of each lines, tell how many times the digit of '1' to '5' are appeared?
Input Sample:
14793685  
2586973  
3692584  
7894563 
Output Sample:
14793685 4  
2586973 3  
3692584 4  
7894563 3
Answer:
Hint: You need to Download and install "Replace Pioneer" on windows platform to finish following steps.
It's pretty easy! 
1. ctrl-o open source file.  
2. ctrl-h open 'Replace' dialog,  
in 'Replace' window,   
* set 'Replace Unit' to 'Line'  
* fill in 'Search for Pattern':  
 
* fill in 'Replace with Pattern': 
 
3. click 'Replace' 
Note: $match means the matched line itself£¬count($match,"[12345]") means calculate the appearance of '12345', \n means return. 
Download Script:  scripts/144.rst.zip

Screenshot 1:  Replace_Window


Similar Examples:
How to repeat each line multiple times with number increased/decreased? (47%)
How can I replace the 3rd lines of many files to a fixed string? (46%)
How to sort each line of text by the order of reversed line? (45%)
How to replace the first 3 characters of each line to fixed characters and add 'a' at the end? (45%)
Can I change the word order of each line and add a comma as separator? (45%)
How to duplicate each line 5 times in a text file? (44%)
How to make a DOS batch file that can rename many swf files according to lists? (43%)
How to add some text after the 5th line for every file in a directory? (43%)

Check Demo of Count and statistics
Keywords:
12345  1234  123  tel  return  times  calculate  digit  dig  match count  calculate lines  5 lines  line of  line with  how to match  match 1 2  how to line  file line