2002-02-18 00:00:00 +00:00
|
|
|
<!DOCTYPE html PUBLIC "-//W3C/DTD HTML 3.2 Final//EN">
|
2001-01-15 00:00:00 +00:00
|
|
|
<html><head>
|
|
|
|
<title>BVI: Partial File Read</title>
|
|
|
|
<link rel=stylesheet type="text/css" href="bvi.css">
|
|
|
|
</head><body bgcolor="#ffffff" background="gif/bg2.gif">
|
|
|
|
<a name="top"></a>
|
|
|
|
|
|
|
|
<table width="100%" border="0" cellspacing="0" cellpadding="0">
|
|
|
|
<tr><td width="1%" valign="top" align="center">
|
2002-02-18 00:00:00 +00:00
|
|
|
<img src="gif/dot.gif" width="130" height="1" alt="">
|
2001-01-15 00:00:00 +00:00
|
|
|
|
|
|
|
<hr noshade width="60%">
|
|
|
|
<p>
|
|
|
|
<a class="thl" href="index.html">Home</a><br>
|
|
|
|
</p>
|
|
|
|
<p>
|
|
|
|
<a class="thl" href="quick.html">Quick Tutorial</a><br>
|
|
|
|
<a class="ths" href="qt_edit.html">Editing Files</a><br>
|
|
|
|
<a class="ths" href="qt_search.html">Search Commands</a><br>
|
|
|
|
<a class="ths" href="qt_bit.html">Bit-wise Operations</a><br>
|
|
|
|
<a class="ths" href="qt_find.html">Find and Replace</a><br>
|
|
|
|
<a class="ths" href="qt_yank.html">Yank and Put</a><br>
|
|
|
|
<a class="ths" href="qt_set.html">Settings</a><br>
|
|
|
|
<font color="#ffffff" class="ths">Partial File Read<br></font>
|
|
|
|
</p>
|
|
|
|
<p>
|
|
|
|
<a class="thl" href="download.html">Download</a><br>
|
|
|
|
</p>
|
|
|
|
<p>
|
|
|
|
<a class="thl" href="install.html">Installation</a><br>
|
|
|
|
</p>
|
|
|
|
<p>
|
|
|
|
<a class="thl" href="overview.html">Command Overview</a><br>
|
|
|
|
</p>
|
|
|
|
<p>
|
|
|
|
<a class="thl" href="bmore.html">bmore</a><br>
|
|
|
|
</p>
|
|
|
|
<p>
|
|
|
|
<a class="thl" href="german.html">Deutsche Beschreibung</a><br>
|
|
|
|
</p>
|
|
|
|
<hr noshade width="60%">
|
|
|
|
|
|
|
|
</td>
|
2002-02-18 00:00:00 +00:00
|
|
|
<td width="1%"><img src="gif/dot.gif" width="40" height="1" alt=""></td>
|
2001-01-15 00:00:00 +00:00
|
|
|
<td width="99%">
|
|
|
|
|
|
|
|
<table width="100%" cellspacing="0" cellpadding="0" border="0">
|
|
|
|
<tr><td width="99%">
|
|
|
|
<font class="head">Quick Tutorial</font>
|
|
|
|
<br><font class="sub">Partial File Read</font>
|
|
|
|
</td>
|
|
|
|
<td align="right" valign="bottom" width="116" rowspan="2">
|
|
|
|
<a href="index.html">
|
|
|
|
<img src="gif/bvi_s.gif" alt="BVI" width="116"
|
|
|
|
height="62" border="0"></a>
|
|
|
|
</td></tr>
|
|
|
|
<tr><td valign="bottom">
|
|
|
|
<hr noshade>
|
|
|
|
</td></tr></table>
|
|
|
|
|
|
|
|
<p>
|
|
|
|
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.
|
|
|
|
<BR>
|
|
|
|
Example:
|
|
|
|
<BR>
|
|
|
|
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 <TT>-s</TT>
|
|
|
|
option you can load only the first kilobyte of the file:
|
|
|
|
<PRE>
|
|
|
|
bvi -s 1000 large.gif
|
|
|
|
</PRE>
|
|
|
|
In this case of course you cannot insert or delete bytes of the file.
|
|
|
|
The editor is set to the <I>no memmove</I> 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.
|
|
|
|
<P>
|
|
|
|
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 <TT>-b</TT>.
|
|
|
|
You can read the file from this starting point until the end of the file
|
|
|
|
or you can use the <TT>-s</TT> option to specify a size or the
|
|
|
|
<TT>-e</TT> option to specify an end address.
|
|
|
|
<P>
|
|
|
|
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 <TT>:set offset=<I>nnnn</I></TT> command, this has
|
|
|
|
<B>no</B> 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.
|
|
|
|
<P>
|
|
|
|
In the Linux <TT>/proc</TT> 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 <TT>-s</TT> option and guess a
|
|
|
|
size. This size should be a little bit larger than the size you expect.
|
|
|
|
<P>
|
|
|
|
The same guidlines can be used, if you load a block device, e.g. a
|
|
|
|
floppy disk.
|
|
|
|
<PRE>
|
|
|
|
bvi -s 1450k /dev/fd0
|
|
|
|
</PRE>
|
|
|
|
After reading the device, you get a message with the value of the
|
|
|
|
real read bytes at the bottom of the screen:
|
|
|
|
<PRE>
|
|
|
|
"/dev/fd0" range 0-1474559
|
|
|
|
</PRE>
|
|
|
|
Note that the <I>size</I> value will be used to allocate memory before
|
|
|
|
reading the file. Therefore do not choose a too large size.<BR>
|
|
|
|
Note further, that <I>1450k</I> in the example above is calculated as
|
|
|
|
<I>1450 * 1024</I> bytes. This gives <I>1484800</I> bytes allocated size.
|
|
|
|
If <STRONG>bvi</STRONG> reads the exact number of bytes you have asked for
|
|
|
|
in the <TT>-s</TT> option, the file may be larger.
|
|
|
|
<P>
|
|
|
|
<B>WARNING:</B>
|
|
|
|
<BLOCKQUOTE>
|
|
|
|
Do not use <STRONG>bvi</STRONG> at mounted disk devices!<BR>
|
|
|
|
Do not edit disk devices, if you don't know exactly what you change!<BR>
|
|
|
|
You may make your disk unreadable by editing it!!
|
|
|
|
</BLOCKQUOTE>
|
|
|
|
<H3>Interaction with <STRONG>bmore</STRONG></H3>
|
|
|
|
You may use <STRONG>bmore</STRONG> to browse through large files or
|
|
|
|
devices. You may use the ASCII - or Hex - search possibilities to
|
|
|
|
locate a certain section of the file.<BR>
|
|
|
|
If you see the desired part of the file on your screen, press <I><B>w</B></I> to
|
|
|
|
read the contents of the file displayed currently on your screen into
|
|
|
|
<STRONG>bvi</STRONG>. You can use a decimal prefix at the <I><B>w</B></I> -
|
|
|
|
command to read more or less bytes than displayed into <STRONG>bvi</STRONG>.
|
|
|
|
<BR>
|
|
|
|
The letter <I><B>w</B></I> is the next letter after <I><B>v</B></I>, which
|
|
|
|
is used in more and bmore to read the whole file into vi or bvi!
|
|
|
|
<P>
|
|
|
|
If you used the <TT>ZZ</TT> or <TT>:w</TT> command, this part of the file will be
|
|
|
|
written back into the original file.
|
|
|
|
|
|
|
|
<p><font size="-1">
|
|
|
|
<a class="btop" href="#top">
|
|
|
|
<img border="0" width="16" height="7" src="gif/up.gif"
|
|
|
|
alt="Back to the top">Back to the top</a>
|
|
|
|
</font>
|
|
|
|
<hr noshade>
|
|
|
|
<i>Last update: Sun Jul 09 21:57:38 CEST 2000 by Gerhard Bürgmann</i>
|
|
|
|
</td></tr></table>
|
|
|
|
</body></html>
|