i have this below string which i need to convert it to HEX. i have already tried it but it showing extra few things on it.. let me show what i have done and what is the output i am getting and what is the desired output
the input string is
"!\"\"\"\"\"\"\"!\"\"\"\"\"\"\""
which is technically nothing but below
!"""""""!""""""""
so as for now consider that string is already present in variable myString
myString=$( echo $myString | sed 's/\\//g' )
#above command to strip \ in between '"'
len=${#myString}
cutString=${myString:1:$len-1}
#above command to strip additional '"' at first and last character.
echo $cutString
echo $cutString | xxd -c 256 -ps
#above command to convert it to HEX
output obtained as of now is as below
21222222222222222122222222222222220a
BUT the actual output for
!"""""""!""""""""
should be
2122222222222222212222222222222222
32 characters.
as according to
http://www.string-functions.com/string-hex.aspx
any help on this is deeply appreciated. thanks