Replace Pioneer Home   All Examples   Free Download

 New request --free  RSS: Replace Pioneer Examples

1348.Count and statistics -- How to count the number of consecutive identical lines?

User: Verotiana -- 2016-02-23          << 1347  1349 >>
Hits: 2723
Type: Count and statistics   
Search all Count and statistics examples
Description:
Count the number of consecutive identical lines based on non-empty columns.  
Output the number of times the line occur followed by the line.
Input Sample:
 47, F, R, E, C, D, , , , , , , , , ,  
 47, F, R, E, C, D, R, , , , , , , , ,  
 48, F, R, E, , , , , , , , , , , ,  
 48, F, R, E, D, , , , , , , , , , ,  
 48, F, R, E, D, R, , , , , , , , , ,  
 49, F, R, E, , , , , , , , , , , ,  
 49, F, R, E, D, , , , , , , , , , ,  
 49, F, R, E, D, R, , , , , , , , , ,  
 49, F, R, E, D, R, , , , , , , , , ,  
 49, F, R, E, D, R, , , , , , , , , ,  
 49, F, R, E, D, R, , , , , , , , , ,  
 49, F, R, E, D, R, , , , , , , , , ,  
 62, F, R, E, , , , , , , , , , , ,
Output Sample:
1  47, F, R, E, C, D, , , , , , , , , ,  
1  47, F, R, E, C, D, R, , , , , , , , ,  
1  48, F, R, E, , , , , , , , , , , ,  
1  48, F, R, E, D, , , , , , , , , , ,  
1  48, F, R, E, D, R, , , , , , , , , ,  
1  49, F, R, E, , , , , , , , , , , ,  
1  49, F, R, E, D, , , , , , , , , , ,  
5  49, F, R, E, D, R, , , , , , , , , ,  
1  62, F, R, E, , , , , , , , , , , , 
Answer:
Hint: You need to Download and install "Replace Pioneer" on windows platform to finish following steps.
1. ctrl-o open text file 
2. ctrl-h open 'replace' dialogue 
* set 'replace unit' to 'Paragraph' 
* set 'replace with pattern' to: 
 
* click 'settings' tab: 
set 'para start' to other:  
set 'para end' to None 
3. click 'replace', done.

Screenshot 1:  Replace_Window


Screenshot 2:  Replace_Settings_Window


Similar Examples:
How to count the number of consecutive lines with specified pattern? (71%)
How to count the number of specified part in each line? (66%)
How to count the number of occurrence of every double letters? (63%)
How to count the consecutive lines with the same pattern? (62%)
How to count the number of records for each month in a web log file? (62%)
How to convert all numbers from decimal to percentage? (59%)
How to count the number of Unique IP address from a web log file? (59%)
How to count and sort the frequency of each line? (59%)

Check Demo of Count and statistics
Keywords:
empty  identical  based on  consecutive  onsecutive  previous  cut  times  non  paragraph  empty line  replace empty line  count consecutive lines  count columns  count number of lines  replace with previous line  count start  replace text number count