View Single Post

   
  #3 (permalink)  
Old 01-05-2008, 12:34 PM
Ian Northeast
 
Posts: n/a
Default Re: Replace tab character with spaces

On Tue, 10 Apr 2007 08:58:47 -0400, David Groff wrote:

> What command can be used for replacing the tab character with spaces?
> Where the number of spaces is equivalent to the number of spaces in a tab.
> I've tried expand, but this doesn't seem to work. I also tried using tr a
> while ago, but when I tried to compile fortran code the tab characters are
> not removed. Perhaps I am not using tr correctly. Any suggestions would be
> appreciated. Thank You


Expand should work. What's going wrong when you try it? What AIX version
and manintenance level do you have?

I don't think tr will do what you want, it replaces characters with single
characters, not strings.

Sed should do: sed -e "s/<tab>/<however many spaces>/g" - except that this
will replace each tab with the same number of spaces, it won't column
align.

Also there's untab but it doesn't do anything expand won't and is not very
flexible (e.g. tab size fixed at 8 spaces).

Regards, Ian

Reply With Quote