Say I have a file with lines like the two following:
I would like to count how many times I have
,, (two consecutive commas surrounded by any other character) in each line.
My approach so far: I thought I could first get rid of everything but any pair of consecutive commas on each line, and then replace those two commas by a single comma so that I can count them later. How can I do this?
The answer above should be (if we substitute the double comma by a single comma throwing everything else away):