I want to do something like this. Say I have the text below:
Start-pattern
orange
apple
grape
orange
orange
End-pattern
bla bla bla
Start-pattern
orange
apple
grape
apple
orange
End-pattern
bla bla bla
Start-pattern
orange
orange
orange
End-pattern
bla bla bla
Here I want to print how many oranges, apples and grapes are between each of Start-patternand End-pattern.
In the above example, we have 3 "orange", 1 "apple" and 1 "grape" between the 1st start and the end. 2 "orange", 2 "apple" and 1 "grape" in the 2nd SP and EP, etc.
Waiting for your valuable answers.
source
share