利用Emacs编辑字节流文件
来源:互联网 发布:创建数据表的sql语句 编辑:程序博客网 时间:2024/06/08 19:29
42 Editing Binary Files
There is a special major mode for editing binary files: Hexl mode. To use it, use M-x hexl-find-file instead of C-x C-f to visit the file. This command converts the file’s contents to hexadecimal and lets you edit the translation. When you save the file, it is converted automatically back to binary.
You can also use M-x hexl-mode to translate an existing buffer into hex. This is useful if you visit a file normally and then discover it is a binary file.
Ordinary text characters overwrite in Hexl mode. This is to reduce the risk of accidentally spoiling the alignment of data in the file. There are special commands for insertion. Here is a list of the commands of Hexl mode:
- C-M-d
Insert a byte with a code typed in decimal.
- C-M-o
Insert a byte with a code typed in octal.
- C-M-x
Insert a byte with a code typed in hex.
- C-x [
Move to the beginning of a 1k-byte “page”.
- C-x ]
Move to the end of a 1k-byte “page”.
- M-g
Move to an address specified in hex.
- M-j
Move to an address specified in decimal.
- C-c C-c
Leave Hexl mode, going back to the major mode this buffer had before you invoked
hexl-mode
.
Other Hexl commands let you insert strings (sequences) of binary bytes, move by short
s or int
s, etc.; type C-h a hexl-RET for details.
备注:
1)在Hexl Mode中不能直接编辑字节值,而只能通过更改相应的ASCII字符来更新字节值,这就限制了能够取到的字节值的范围
2)在Hexl Mode中不能直接删除字节,虽然可通过如下方式,来“曲线救国”:
Hexl mode does not allow you to delete characters. This answer from stack overflow suggests a workaround: overwrite the characters you want to delete with another character (say "X"), switch out of hexl mode, find the characters and delete them there.
综上,Emacs的Hexl Mode对于作为一个编辑字节流数据的工具来说,是个鸡肋。
参考文献:
[1]https://www.gnu.org/software/emacs/manual/html_node/emacs/Editing-Binary-Files.html
[2]http://superuser.com/questions/204576/delete-data-from-the-middle-of-a-binary-file-with-hexl-mode
- 利用Emacs编辑字节流文件
- 利用VI/VIM编辑字节流文件
- 用Emacs远程编辑文件
- Java利用字节流 单字节复制 文件
- emacs: 文件编辑_查找替换
- Emacs中连接FTP 编辑远程文件
- unix 编辑文件 vim 或者 emacs
- 利用字节流缓冲拷贝一个MP3文件
- Java基础回顾 : 利用字节流实现文件的拷贝
- 为emacs编辑urdf文件增加代码补全功能
- Emacs 基本编辑命令
- emacs编辑二进制文件
- 用emacs编辑c#
- 加快emacs编辑速度
- Emacs编辑缓冲区
- emacs常用编辑命令
- emacs编辑二进制文件
- emacs编辑二进制文件
- 查看Oracle执行计划方法
- 取消div,a等标签点击效果
- org.apache.struts2.json.JSONExce…
- Java控制台读取输入
- 枚举类型
- 利用Emacs编辑字节流文件
- smp-symmetric multi-processor 对称多处理器
- CodeModel操作失败
- linux loop 设备
- TCP的可靠性
- C语言实现 输入数字按从小到大排序
- xml的创建 c++哦
- hdu2544 最短路 模板题
- 常用sql语句之删除或查询单个字段重复数据的记录