Unix – Fetching ASCII Code of any Character and Character Value from the ASCII Code
This is the demo of fetching ASCII code of any character value and vice versa (Character value from the ASCII Code).
The below is the demo for the “A” and “65”.
Ascii value of character:
It can be done in 2 ways:
- printf “%d” “‘A”
- echo “A” | tr -d “n” | od -An -t dC
Character value from Ascii:
awk -v char=65 ‘BEGIN { printf “%cn”, char; exit }’