Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

11
  • 2
    Are you looking for an nvi solution, or a general command-line solution? Commented Mar 28, 2019 at 7:16
  • 1
    expand (from GNU coreutils) would seem to be the obvious generic solution e.g. expand -it3 to replace each initial tab with 3 spaces Commented Mar 28, 2019 at 11:03
  • sed 's/^\t\t*/ /' replace leading tabs with 2 spaces Commented Mar 28, 2019 at 15:53
  • sorry, I meant replacing leading tabs with two spaces per tab. Commented Mar 28, 2019 at 15:59
  • @GregoryNisbet If you want i read it add @ before my name. You can try sed ':A;s/(^\t)(\t*)/\2 /;tA' Commented Mar 28, 2019 at 16:17