Skip to content

Instantly share code, notes, and snippets.

@takumikinjo
Last active January 2, 2016 23:09
Show Gist options
  • Save takumikinjo/8374531 to your computer and use it in GitHub Desktop.
Save takumikinjo/8374531 to your computer and use it in GitHub Desktop.
Fill the columns of a outline text.
#!/usr/bin/env perl
# outlinefill.pl <outline indent chars> <output delimiter>
@b = ();
while (<STDIN>) {
chomp;
@a = split /$ARGV[0]/, $_;
@b = () if ($#a < $#b);
foreach $i (0 .. $#a + 1) { $b[$i] = $a[$i] if ($a[$i]) }
print join(eval("\"$ARGV[1]\""), @b)."\n";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment