convert HEX to Char
来源:互联网 发布:python 列表与元组 编辑:程序博客网 时间:2024/05/13 12:04
perl:
trim non-HEX chars
echo 333961363a73746f72616765746965725f7573616765 | perl -ne 's/([0-9a-f]{2})/print chr hex $1/gie'
not convert non-HEX chars
echo -n 333961363a73746f72616765746965725f757361676566\ 66 | perl -pe 's/([0-9a-f]{2})/chr hex $1/gie'
xxd:
echo 333961363a73746f72616765746965725f7573616765 |xxd -r -p
shell:
#!/bin/bashif [ $# -eq 0 ]; then echo "parameter error" exitfistr=$1num=$(echo $str |wc -c)i=1while [ $i -lt $num ]; do substr=$( echo $str|cut -c $i-$((i+1)) ) echo -en "\x$substr" i=$((i+2))doneecho
refer:
http://stackoverflow.com/questions/1604765/linux-shell-scripting-hex-string-to-bytes
0 0
- convert HEX to Char
- convert Hex to Bin
- ASC Table, Convert String to Hex String
- Convert jQuery RGB output to Hex Color
- Convert int/long to hex string.
- how to convert char to char []
- convert unsigned long to char*
- How to convert InputStream to String/convert char[] to String
- How to convert wchar_t* to char*
- [C++] Hex string convert to integer with stringstream
- Convert a byte array to a Hex string
- [C Language Utility]Convert Hex String to string represented by its corresponding Hex Values
- Cannot convert from 'const char [..]' to 'LPCTSTR'
- Cannot convert from 'const char [..]' to 'LPCTSTR'
- cannot convert wchar_t to const char*
- E2034 Cannot convert 'wchar_t *' to 'const char *'
- char* convert to string and back
- Convert Between char* string to wchar_t* string
- kafka Replication tools
- android linphone中opengl显示的实现
- Ogre 粒子系统及粒子脚本
- JavaScript ---(function...)():2个小括号的理解
- Java 反射(成员方法) 相当暴力啊 暴力反射
- convert HEX to Char
- Spark源码解析——Shuffle
- python学习笔记-03
- js中数组的排序
- 云图-最有爱的画图涂鸦手绘作品册概念的iPad APP
- psutil模块功能介绍
- Android Wi-Fi Direct 开发指南
- 测试文章
- 黑马程序员_反射