Am 2014-07-17 10:11, schrieb Dr. Werner Fink:
On Thu, Jul 17, 2014 at 03:36:45AM +0200, David Haller wrote:
Am Wed, 16 Jul 2014, Alex Winzer schrieb:
ich suche einen einfachen Hex-Editor _für die Konsole_. Wenn ich bei yast nach "hex" suche, dann werden mir ein paar Editoren angezeigt. [..] Ich brauche das Ding nur, um ein paar Bytes am Anfang einer bösen Windows Partition (mit dd ausgelesen) zu ändern und wieder (ebenfalls mit dd) zurückzuschreiben.
Nimm vche. Mit dem hab ich sowas auch schon gemacht. http://software.opensuse.org/package/vche?search_term=vche
Hmmm ... also wenn emacs mit hexl-mode zu unhandlich ist, vim hat einen binary mode, d.h.
vim -b
sollte den job machen. Mit einem vimrc code im eigenen ~/.vimrc oder ~/.exrc sollte das machbar sein
Nicht wirklich. ,----[ :h -b ]- | *-b* | -b Binary mode. File I/O will only recognize <NL> to separate | lines. The 'expandtab' option will be reset. The 'textwidth' | option is set to 0. 'modeline' is reset. The 'binary' option | is set. This is done after reading the vimrc/exrc files but | before reading any file in the arglist. See also | |edit-binary|. {not in Vi} `---- ,----[ :h edit-binary ]- | 8. Editing binary files *edit-binary* | | Although Vim was made to edit text files, it is possible to edit binary | files. The |-b| Vim argument (b for binary) makes Vim do file I/O in binary | mode, and sets some options for editing binary files ('binary' on, 'textwidth' | to 0, 'modeline' off, 'expandtab' off). Setting the 'binary' option has the | same effect. Don't forget to do this before reading the file. | | There are a few things to remember when editing binary files: | - When editing executable files the number of characters must not change. | Use only the "R" or "r" command to change text. Do not delete characters | with "x" or by backspacing. | - Set the 'textwidth' option to 0. Otherwise lines will unexpectedly be | split in two. | - When there are not many <EOL>s, the lines will become very long. If you | want to edit a line that does not fit on the screen reset the 'wrap' option. | Horizontal scrolling is used then. If a line becomes too long (more than | about 32767 characters on the Amiga, much more on 32-bit systems, see | |limits|) you cannot edit that line. The line will be split when reading | the file. It is also possible that you get an "out of memory" error when | reading the file. | - Make sure the 'binary' option is set BEFORE loading the | file. Otherwise both <CR> <NL> and <NL> are considered to end a line | and when the file is written the <NL> will be replaced with <CR> <NL>. | - <Nul> characters are shown on the screen as ^@. You can enter them with | "CTRL-V CTRL-@" or "CTRL-V 000" {Vi cannot handle <Nul> characters in the | file} | - To insert a <NL> character in the file split up a line. When writing the | buffer to a file a <NL> will be written for the <EOL>. | - Vim normally appends an <EOL> at the end of the file if there is none. | Setting the 'binary' option prevents this. If you want to add the final | <EOL>, set the 'endofline' option. You can also read the value of this | option to see if there was an <EOL> for the last line (you cannot see this | in the text). `---- Es geht aber mit xxd (im Paket mit Vim drin sein): ,----[ :h hex-editing ]- | Hex editing *hex-editing* *using-xxd* | | See section |23.4| of the user manual. | | If one has a particular extension that one uses for binary files (such as exe, | bin, etc), you may find it helpful to automate the process with the following | bit of autocmds for your <.vimrc>. Change that "*.bin" to whatever | comma-separated list of extension(s) you find yourself wanting to edit: > | | " vim -b : edit binary using xxd-format! | augroup Binary | au! | au BufReadPre *.bin let &bin=1 | au BufReadPost *.bin if &bin | %!xxd | au BufReadPost *.bin set ft=xxd | endif | au BufWritePre *.bin if &bin | %!xxd -r | au BufWritePre *.bin endif | au BufWritePost *.bin if &bin | %!xxd | au BufWritePost *.bin set nomod | endif | augroup END `---- Viele Grüße, Christian -- Um die Liste abzubestellen, schicken Sie eine Mail an: opensuse-de+unsubscribe@opensuse.org Um den Listen Administrator zu erreichen, schicken Sie eine Mail an: opensuse-de+owner@opensuse.org