hex2bin.pl: replace spaces with dots for better view
[terpinus.git] / hex2bin.pl
blob0a7e378d04a79119234677aadc481b722f2101cd
1 #!/usr/bin/perl
3 while (<>) {
4 if (m/^([0-9A-F]+)$/) {
5 $full = $&;
6 $t = $1;
7 $t =~ s/0/......../g;
8 $t =~ s/1/......##/g;
9 $t =~ s/2/....##../g;
10 $t =~ s/3/....####/g;
11 $t =~ s/4/..##..../g;
12 $t =~ s/5/..##..##/g;
13 $t =~ s/6/..####../g;
14 $t =~ s/7/..######/g;
15 $t =~ s/8/##....../g;
16 $t =~ s/9/##....##/g;
17 $t =~ s/A/##..##../g;
18 $t =~ s/B/##..####/g;
19 $t =~ s/C/####..../g;
20 $t =~ s/D/####..##/g;
21 $t =~ s/E/######../g;
22 $t =~ s/F/########/g;
23 print "$full\t$t\n";
25 else {
26 print $_;