Created
April 23, 2012 11:49
-
-
Save saitoha/2470392 to your computer and use it in GitHub Desktop.
きのう書いたやつ
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
my %bank = (); | |
my $i = 0; | |
open (IN, $ARGV[0]) or die "cannot open specified file."; | |
foreach $line (<IN>) { | |
if ($line =~ /^"(..) c (#[A-Z0-9]{6})"/) { | |
$bank{$1} = $i; | |
print "\e]4;$i;$2\e\\"; | |
$i++; | |
} elsif ($line =~ /\"(.+)",/) { | |
foreach $c ($1 =~ /../g) { | |
print "\e[48;5;", $bank{$c}, "m "; | |
} | |
print "\n"; | |
} | |
} | |
close (IN); | |
=head1 EXAMPLES | |
> xpm2term.pl sample.xpm | |
=head1 AUTHOR | |
saitoha <<user@zuse.jp>> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment