tabs converted to spaces?

Dave Turner dmt at ptsfa.PacBell.COM
Thu Jul 21 03:55:07 AEST 1988


In article <3940001 at hpgrla.HP.COM> douglasg at hpgrla.HP.COM (@Douglas Genetten) writes:
>Is there a filter which converts tabs to n-spaces throughout
>a file?

You might try newform and/or sed.

newform will convert tabs into the correct number of spaces so that the
output will appear to have been printed on a printer with tab stops.
If your input file assumes that tabs are to appear to have been set every
eight spaces try:

	newform -i-8 -o-0 < inputfile

If you want each tab to be converted into a fixed number of spaces use sed:

	sed -n -e "s/	/ /p" < inputfile

If you want each tab converted into exactly one space tr will also work.

-- 
Dave Turner	415/542-1299	{att,bellcore,sun,ames,pyramid}!pacbell!dmt



More information about the Comp.unix.questions mailing list