-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaschii-table
More file actions
executable file
·52 lines (42 loc) · 1.72 KB
/
aschii-table
File metadata and controls
executable file
·52 lines (42 loc) · 1.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/env bash
#
# ############################################################################
# Project: scripts (none)
# File...: aschii-table
# Created: Monday, 2020/02/22 - 18:25:19
# Author.: @shmatt, (stackoverflow)
# ~·~·~·~·~·~·~·~·~·~·~·~·~~·~·~·~·~·~·~·~·~·~·~·~·~~·~·~·~·~·~~·~·~·~·~·~·~·~
# Last Modified: Monday, 2023/09/04 - 00:07:09
# Modified By..: @fbnmtz, (fabiano.matoz@gmail.com)
# ~·~·~·~·~·~·~·~·~·~·~·~·~~·~·~·~·~·~·~·~·~·~·~·~·~~·~·~·~·~·~~·~·~·~·~·~·~·~
# Version: 1.0.0.12
# ~·~·~·~·~·~·~·~·~·~·~·~·~~·~·~·~·~·~·~·~·~·~·~·~·~~·~·~·~·~·~~·~·~·~·~·~·~·~
# Description:
# >
# ############################################################################
# HISTORY:
#
# heading index with div line
printf "\n "; # indent
for x in {0..15}; do printf "%-3x" $x; done;
printf "\n%46s\n" | sed 's/ /-/g;s/^/ /';
# two lines with dots to represent control chars
c=$(echo "fa" | xxd -p -r | iconv -f 'CP437//' -t 'UTF-8')
printf "%32s" | sed 's/../'"$c"' /g;s/^/ 0 /;s/$/\n\n/'
printf "%32s" | sed 's/../'"$c"' /g;s/^/ 1 /'
# convert dec to codepage 437 in a table
for x in {32..255};
do
# newline every 16 translated code values
(( x % 16 == 0 )) && printf "\n\n"
# left index numbers
let "n = x % 15"
(( (x % 16) == 0 )) && printf "%-4x" $n | sed 's/0/f/;s/^/ /'
# conversion of x integer value to symbol
printf "%02x" $x | xxd -p -r | iconv -f 'CP437//' -t 'UTF-8' | sed 's/.*/& /'
# div line
(( x == 127 )) && printf "%46s" | sed 's/ /-/g;s/^/ /;i\ '
done
printf "%46s" | sed 's/ /-/g;s/^/\n /;s/$/\n /'; # div line
for x in {0..15}; do printf "%-3x" $x; done;
echo