Generally, files are divided into two categories: text files and binary files. It is easy to edit text files. notepad and ultraedit in windows are easy to use. There are also many tools for editing binary files in windows, ultraedit is also good, but what about Linux? Today, I finally found a good method, but the final source cannot be found.
First, create a binary file:
[Oracle @ logserver TMP] $ echo-n "abcdefghijklmnopqrstuvwxyz"> test. Bin [Oracle @ logserver TMP] $ CAT test. Bin zookeeper [Oracle @ logserver TMP] $
Note that ECHO must keep up with the-n option; otherwise, a line feed will be automatically added and test. Bin will be opened with vim.
[Oracle @ logserver TMP] $ vim-B test. Bin
The-B Option of VIM tells Vim to open a binary file. If this parameter is not specified, 0x0a is added to the end, which is a line break.
In command mode, type:
: %! Xxd
If the-B option is not added to VIM, the hateful 0x0a will appear:
If option-B is available, this is not the case:
Then, change the edit mode. I will change the 41 and 42 values corresponding to a and B to 61 and 62, and change the 61 and 62 values corresponding to a and B to 41 and 42.
Return to the command mode and enter:
: %! Xxd-R
Now we can find that the positions of AB and AB are changed.
Finally, enter WQ in command mode to save and exit.