in reply to One liner asked... :)

use vars qw($spaces); my $spaces = " " x shift; while (<>) { s/\t/$spaces/g; # Tabs to spaces. # Perform substitution the other way # for spaces to tabs. print; } #
It's not one line, though. In golf mode: perl -pe 's/\t/q( )x$n/ge;' replacing $n with some number.

There's a program somewhere in textutils, in the GNU toolkit, that will do this too.

Update: Changed according to MeowChow's suggestion.

Replies are listed 'Best First'.
Re: Re: One liner asked... :)
by MeowChow (Vicar) on Apr 23, 2001 at 20:49 UTC
    You left out a few things. I believe you mean:
    perl -pe 's/\t/q( )x$n/ge' ...
       MeowChow                                   
                   s aamecha.s a..a\u$&owag.print