You probably do not want to replace a tab character with exactly 4 spaces. If tabstops are set at exactly 4 spaces, then a tab might be one space or it might be 4 spaces or anything in between. The idea with tabs is to get stuff to line up. If this is the the case, you need to use the "expand" program. There is also an unexpand program and both have man pages.