title: Apache beam global counter
body: <p>I have a file with say million records, and some of the records are bad records (which will be known when the records are processed in a ParDo).  I want to write the bad records to a separate PCollection along with their line numbers in which they appear in the file and good records to a separate PCollection.  </p>
  
  <p>Is there a way to maintain a global counter of the lines read so far across worker process so that I could use it to write out the line numbers?</p>