tabs converted to spaces?

Arthur S. Kamlet ask at cbnews.ATT.COM
Wed Aug 3 15:50:23 AEST 1988


>> >Is there a filter which converts tabs to n-spaces throughout
>> >a file?

>> You might try newform and/or sed.

>Several replies have mentioned tr or sed. I assume that the desired
>result is to convert tabs to spaces *in a fomat preserving manner*.
>The correct standard tool to do this in UNIX is expand. Expand is
>designed to perform exactly this function (and its inverse 'unexpand')
>and does so very well.

On our UNIX V system, col -x works pretty  well.

	col -x < oldfile   > newfile

	or: cat oldfile | col -x  > newfile

seems to work rather quickly and simply.

-- 
Art Kamlet  ask at cbrmb.att.com  AT&T Bell Laboratories, Columbus



More information about the Comp.unix.questions mailing list