I want to replace each group of spaces with a single comma in code block marker in every markdown file.
For example I have this code block:
```html class1 class2
Note that above line have two group of spaces, one with 3 spaces, other with single space.
I want to replace it to:
```html,class1,class2
I have tried following command without success:
find src -type f -name "*.md" -exec sed -i s/^(?<=```)( )+/,/g {} +
Meaning: if a line contains ``` at the start then replace all spaces with comma.
But it doesn't work.
What is correct command should I use here?