I know how to dump a string and check hex code via piping the output from terminal to hexdump
for example :
$ echo ‘–allowerasing’ | hexdump -C
00000000 e2 80 98 e2 80 93 61 6c 6c 6f 77 65 72 61 73 69 |......allowerasi|
00000010 6e 67 e2 80 99 0a |ng....|
00000016
But when comes to compare string, I cannot just use diff YY ZZ
as like comparing files and I found out using dollar sign $(echo YY)
are not acceptable and failed to process but I figure out the workaround, which is to use <(echo ZZ)
to create temporary named pipes:
$ diff <(echo ‘‐‐allowerasing’ | hexdump -C) <(echo ‘–allowerasing’ | hexdump -C)
1,3c1,3
< 00000000 e2 80 98 e2 80 90 e2 80 90 61 6c 6c 6f 77 65 72 |.........allower|
< 00000010 61 73 69 6e 67 e2 80 99 0a |asing....|
< 00000019
---
> 00000000 e2 80 98 e2 80 93 61 6c 6c 6f 77 65 72 61 73 69 |......allowerasi|
> 00000010 6e 67 e2 80 99 0a |ng....|
> 00000016
Robbi Nespu | Bash, Hexdump, Linux, Terminal
The postings on this site are my own and don't necessarily represent my employer’s positions, strategies or opinions.
©Robbi Nespu, 2021 — built with Jekyll + Lagom theme
Home |
Contact |
Archive |
Privacy policy
Discussion and feedback