So I was wondering how to remove the linenumbers and the ascii while outputting data with xxd.
The code:
chst1="$(xxd -u -p -l1 -s 765 "$d2s")"
chst2="$(xxd -u -p -l1 -s 766 "$d2s")"
chst3="$(xxd -u -p -l1 -s 767 "$d2s")"
chst4="$(xxd -u -p -l1 -s 768 "$d2s")"
chst5="$(xxd -u -p -l1 -s 769 "$d2s")"
chst6="$(xxd -u -p -l1 -s 770 "$d2s")"
chst7="$(xxd -u -p -l1 -s 771 "$d2s")"
chst8="$(xxd -u -p -l1 -s 772 "$d2s")"
chst9="$(xxd -u -p -l1 -s 773 "$d2s")"
echo "Hex"
echo " $chst1 $chst2 $chst3 $chst4 $chst5 $chst6 $chst7 $chst8 $chst9 "
echo "Binary"
echo " $chst1 $chst2 $chst3 $chst4 $chst5 $chst6 $chst7 $chst8 $chst9 " | xxd -r -p | xxd -b
Which outputs
Hex
67 66 00 28 08 F0 80 80 0C
Binary
00000000: 01100111 01100110 00000000 00101000 00001000 11110000 gf.(..
00000006: 10000000 10000000 00001100 ...
But I want 00000000: and 00000006: and gf.(.. and ... removed from the output.
As for the amount of variables, this is correct and ugly, but it's the only real working solution I have as they each are a variable on their own within the code.