I just stumbled upon a problem that I find surprisingly difficult. I'd like to replace all tab characters at the beginnings of lines in all *.cc and *.h files with 8 spaces. Something like:
sed 's/\t/ /g' -i *.cc *.h
But only for the beginnings of lines. Keep in mind that sed 's/^\t/ /g' -i *.cc *.h
won't do as it doesn't handle the case when the line begins with multiple tabulation characters.
How can I achieve this using sed?