mirror of
https://github.com/vbatts/bvi.git
synced 2024-11-22 08:35:42 +00:00
113 lines
4.2 KiB
HTML
113 lines
4.2 KiB
HTML
<HTML><HEAD>
|
|
<TITLE>BVI Editing Files</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><IMG SRC="gif/dot.gif" WIDTH=130 HEIGHT=1>
|
|
|
|
<HR NOSHADE WIDTH=60%>
|
|
<P>
|
|
<A CLASS="thl" HREF="index.html">Home</A>
|
|
</P>
|
|
<P>
|
|
<A CLASS="thl" HREF="quick.html">Quick Tutorial</A>
|
|
<FONT COLOR=#FFFFFF CLASS="ths">Editing Files<BR></FONT>
|
|
<A CLASS="ths" HREF="qt_search.html">Search Commands</A>
|
|
<A CLASS="ths" HREF="qt_bit.html">Bit-wise Operations</A>
|
|
<A CLASS="ths" HREF="qt_find.html">Find and Replace</A>
|
|
<A CLASS="ths" HREF="qt_yank.html">Yank and Put</A>
|
|
<A CLASS="ths" HREF="qt_set.html">Settings</A>
|
|
</P>
|
|
<P>
|
|
<A CLASS="thl" HREF="download.html">Download</A>
|
|
</P>
|
|
<HR NOSHADE WIDTH=60%>
|
|
|
|
</TD>
|
|
<TD WIDTH=1%><IMG SRC="gif/dot.gif" WIDTH=40 HEIGHT=1></TD>
|
|
<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>Editing Files</FONT>
|
|
</TD><TD ALIGN=RIGHT VALIGN=BOTTOM WIDTH=116 ROWSPAN=2>
|
|
<IMG SRC="gif/bvi_s.gif" ALT="BVI" WIDTH="116" HEIGHT="62">
|
|
</TD></TR>
|
|
<TR><TD VALIGN=BOTTOM>
|
|
<HR NOSHADE>
|
|
</TD></TR></TABLE>
|
|
|
|
<P>
|
|
Inserting or deleting bytes can be dangerous on some kind of files,
|
|
because binary files are mostly executables, database files or maybe
|
|
graphic files. So you must not shift the remaining bytes to another
|
|
address.
|
|
Therefor commands for inserting or deleting bytes are disabled by
|
|
default.
|
|
You can use the <B>r</B> command to change a single byte, or
|
|
the <B>R</B> command to replace multiple characters. You can use a
|
|
numeric prefix for both commands.
|
|
<P>
|
|
You can add characters at the end of the file using the <B>A</B> command.
|
|
If you start with an empty file, you can create a binary file from
|
|
scratch. If the cursor is in the ASCII section of the screen and you
|
|
type <B><TT>100Ax</TT><FONT COLOR=#AAAAAA>ESC</FONT></B>, you create a file
|
|
which contents 100 x'es.
|
|
<P>
|
|
The <B>D</B> command can be used to truncate a file at a certain position.
|
|
Since there are no lines in a binary file, the <B>D</B> command deletes
|
|
to end of file.
|
|
<P>
|
|
If you have to edit a binary file where it does not matter to move bytes
|
|
to a different address, you can enable the insert and delete commands by
|
|
typing <B>:set memmove</B>.
|
|
Now you are able to use the <B>i</B> command for inserting bytes, the
|
|
<B>x</B> or <B>X</B> command to delete the byte over or before the cursor
|
|
and those types of <B>d</B> commands, which does not rely on text lines
|
|
(e.g. <B>d<FONT COLOR=#AAAAAA>SPACE</FONT></B>, <B>df<TT>C</TT>, d/<TT>xyz</TT>,
|
|
d$, d'a, d<TT>n</TT>G</B>).
|
|
|
|
<P>
|
|
All edits can be undone by pressing the <B>u</B> key.
|
|
<H4>Using ex (colon) commands</H4>
|
|
The edit commands of the <B>ex</B> editor are usually not available in
|
|
standard <B>vi</B> implementations (<TT>:i[nsert], :a[ppend]</TT>
|
|
and <TT>:c[hange]</TT>). In <B><FONT COLOR=#FF0000>bvi</B></FONT>
|
|
they <I>are</I> available with extended options. There are five
|
|
modifiers <TT>a[scii], b[inary], d[ecimal], h[exadecimal]</TT> and
|
|
<TT>o[ctal]</TT> (ascii is default). Therefor you can insert, append
|
|
or change data in all five representations.
|
|
<P>
|
|
<B>Example:</B><BR>
|
|
you would like to append a file with data available in decimal
|
|
representation:
|
|
<BLOCKQUOTE><PRE>
|
|
:a d
|
|
0 12 3 128 255 17 0 0 255 255
|
|
23 24 25 128 6 6 6
|
|
.
|
|
</PRE></BLOCKQUOTE>
|
|
A line with only a period (.) in it will terminate the command.
|
|
<BR>
|
|
You must not type values greater than a byte value (255 decimal, FF hex).
|
|
This causes an abandon of the command.<BR>
|
|
Pressing the <FONT COLOR=#888888>RETURN</FONT> key does <I>not</I> insert
|
|
a newline - character into the file. If you use <B>:i a</B> (insert
|
|
ascii) you can use the special characters \n, \r, \t and \0.
|
|
<P>
|
|
An additional advantage is, that all typed bytes are inserted into the
|
|
file at once. If you insert characters in vi - mode, for every byte typed,
|
|
the whole remaining file has to be moved one position backwards.
|
|
<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: 17 - 06 - 2000 by Gerhard Bürgmann</I>
|
|
</TD></TR></TABLE>
|
|
</BODY>
|
|
</HTML>
|