I’d like to replace the leading space or tab characters on each line of a file with a like-number of other characters (let’s use _ for simplicity).
E.g.
foo bar
foo bar
line 3
becomes
foo bar
_foo bar
__line 3
Note that non-leading whitepsace is not affected, otherwise this would be easy! I suspect it’s still easy, but I’m missing the trick.
This will work for you:
Example