in reply to One liner asked... :)
It's not one line, though. In golf mode: perl -pe 's/\t/q( )x$n/ge;' replacing $n with some number.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; } #
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 |