Home

Quick Tutorial
Editing Files
Search Commands
Bit-wise Operations
Find and Replace
Yank and Put
Settings
Partial File Read

Download

Installation

Command Overview

bmore

Deutsche Beschreibung


Quick Tutorial
Partial File Read
BVI

A new feature of version 1.3.0 is the Partial File Read. If you want to edit a file, you have not to read the file into memory but only the part you want to edit. You can write back this part into the file after editing.
Example:
You have to change only some bytes of the header of a graphic file (e.g. a color). Graphic files can be very large. With the -s option you can load only the first kilobyte of the file:

             bvi -s 1000 large.gif
In this case of course you cannot insert or delete bytes of the file. The editor is set to the no memmove mode. You can write back only as much bytes as you read before. If you add or delete bytes even though, the extra bytes will be ignored or garbage will be written to the file.

It is also possible to start not at the begin of the file, but at a certain address. To do this you have to use the option -b. You can read the file from this starting point until the end of the file or you can use the -s option to specify a size or the -e option to specify an end address.

If you read the file not from the start an offset will be set to display the correct address at the left side of the screen. If you change this offset with the :set offset=nnnn command, this has no effect to the write back operation. The edited part of the file will always be written back at the same position, where it was read.

In the Linux /proc directory there are files which are listed with length 0 in a directory listing. But in reality they have a content. You can read this files, if you use the -s option and guess a size. This size should be a little bit larger than the size you expect.

The same guidlines can be used, if you load a block device, e.g. a floppy disk.

             bvi -s 1450k /dev/fd0
After reading the device, you get a message with the value of the real read bytes at the bottom of the screen:
             "/dev/fd0" range 0-1474559
Note that the size value will be used to allocate memory before reading the file. Therefore do not choose a too large size.
Note further, that 1450k in the example above is calculated as 1450 * 1024 bytes. This gives 1484800 bytes allocated size. If bvi reads the exact number of bytes you have asked for in the -s option, the file may be larger.

WARNING:

Do not use bvi at mounted disk devices!
Do not edit disk devices, if you don't know exactly what you change!
You may make your disk unreadable by editing it!!

Interaction with bmore

You may use bmore to browse through large files or devices. You may use the ASCII - or Hex - search possibilities to locate a certain section of the file.
If you see the desired part of the file on your screen, press w to read the contents of the file displayed currently on your screen into bvi. You can use a decimal prefix at the w - command to read more or less bytes than displayed into bvi.
The letter w is the next letter after v, which is used in more and bmore to read the whole file into vi or bvi!

If you used the ZZ or :w command, this part of the file will be written back into the original file.

Back to the topBack to the top


Last update: Sun Jul 09 21:57:38 CEST 2000 by Gerhard Bürgmann