2 [tag:tabs] is for GUI tabs, not for tab-spaces/tab-stops
| link
1
source | link

Replace each tab ONLY at the beginning of each line with spaces

So replacing all tabs in a file with spaces is not hard.
In vim for example, I can do %s/\t/ /gc

And if I want to replace the ones at the beginning of each line, not the one in the middle I can do %s/^\t/ /gc

But if there are line with one and lines with more tabs at the beginning, and lines with tabs in the middle, and I want to replace each tab in the beginning of a line with spaces to keep the indentation structure of the file, that is what I don't know how to do.

In vim or sed or generally using regular expressions.