acme/bin/t2s
Ev Bogdanov c2271ba672 acme
2017-01-26 19:29:57 +03:00

17 lines
296 B
Perl
Executable file

#!/usr/bin/env perl
use strict;
use warnings;
my $N_SPACES = $ARGV[0] || 4;
while (my $line = <STDIN>) {
# Skip empty lines
print "\n" and next if $line !~ m/\S/;
$line =~ m/^(\t*)(.+)$/;
my $n_tabs = length($1);
my $n_spaces = $n_tabs * $N_SPACES;
print ' ' x $n_spaces . "$2\n";
}