Replace Pioneer Home   All Examples   Free Download

 New request --free  RSS: Replace Pioneer Examples

967.Count and statistics -- How to count the number of consecutive lines with specified pattern?

User: colin -- 2012-07-08          << 966  968 >>
Hits: 1454
Type: Count and statistics   
Search all Count and statistics examples
Description:
How to count the number of consecutive lines with specified pattern? Need to replace each appearence of consecutive lines like format of "25.00/28.00" or "Unfinished" with the count of such lines.
Input Sample:
 PAT
     25.00/28.00 
   lesn1
     5 views
 quiz1 
     7.00/14.00 
      8.00/14.00 
      9.00/14.00 
      13.00/14.00 
      0.00/14.00 
   lesn2 
     4 views
 quiz2  
     10.00/15.00 
      12.00/15.00 
      Unfinished 
   lesn3 
     2 views
Output Sample:
 PAT
1
  lesn1
     5 views
 quiz1 
5
   lesn2 
     4 views
 quiz2  
3
   lesn3 
     2 views
Answer:
Hint: You need to Download and install "Replace Pioneer" on windows platform to finish following steps.
1. open "Tools->Batch Runner" menu
2. drag multiple files to "Batch Runner" window
3. click "Fast Replace" button to open "Fast Replace" dialog
4. click "add" to add new rules
* set 'search' to:

* set 'replace' to:

* click "ok"
5. make sure "reg exp" and "cross line" are selected
6. click "start", done.

Screenshot 1:  Fast_Replace_Window


Similar Examples:
How to count the consecutive lines with the same pattern? (81%)
How to count the number of lines under each specified pattern? (79%)
How to count the number of consecutive identical lines? (71%)
How to count the number of specified part in each line? (68%)
How to rip out all but line 1 and specified text? (63%)
How to change the number in each line to specified order in a text file? (63%)
How to convert numbers into scientific format with specified spacing? (63%)
How to count the number of english words that has specified number of chars? (61%)

Check Demo of Count and statistics
Keywords:
ddd  500  consecutive  onsecutive  cut  toc  statistics  statist  count and statistics  rules  count consecutive lines  count number of lines  count start  specified format  add number to lines  count lines  count each line  button click count