title: Multilevel parsing using shell command
body: <p>I have a file in the following format</p>
  
  <pre><code>/////
  name 1
  start_occurrence:
  occurrence 1
  occurrence 2
  
  ///
  name 2
  start_occurance:
  occurrence 1
  occurrence 2
  
  ///
  name 3
  start_occurrence:
  occurrence 1
  occurrence 2
  occurrence 3
  </code></pre>
  
  <p>All I need is to make a count of the number of occurrences for each name and save them in a CSV file. Can I do it using any combination of shell commands? Yes I can do it programmatically, but looking for a bunch of shell commands in a pipe lined fashion. </p>
  
  <p>"<code>names</code>" can be anything. Names does not come with a pattern. Only catch is that the line after <code>///</code> is the name. Also <code>Occurrence</code> does not have any number with it, anyline that starts with <code>occurrence</code> or have <code>occurrence</code> is a subject of interest.</p>