Home
Quick Tutorial
Editing Files
Search Commands
Bit-wise Operations
Find and Replace
Yank and Put
Settings
Download
Installation
Command Overview
man - Page
Deutsche Beschreibung
|
 |
Quick Tutorial
Search Commands
Additional to the well known / and ? for searching ASCII
strings there are two new commands for searching binary strings. These
are the keys \ and #.
In the ASCII search commands / and ? you can use \n, \r,
\t and \0. You can also use regular expressions. Do not use
^ and $, because there are no lines in a binary file.
Type /foo\0RETURN to
search for the null terminated string foo in the file.
In the Hex section you can search for a sequence of bytes in hexadecimal
notation, e.g. \01 AF 12RETURN,
which is the same as \01AF12
RETURN.
You can also use regular expressions and quoted ASCII strings. Inside of
the quotes no character is treated as a special character!
Example:
\01 [^AF DE] "foo" 00 RETURN
This means: Search for a string beginning with 01, the second character
must not be a hex AF or DE, followed by the ASCII
characters foo, terminated with a binary zero.
Global Search
There is also a global search option available, but only with the
print option.
Example:
:g/text_pattern/pRETURN
or
:g\hex_pattern\pRETURN
This commands are displaying all found patterns, one per screen line.
Of course you can limit the search to a certain part of the file by
specifying the starting and ending address.
Other forms of the global search command
are line oriented, therefor not useful for binary files and
not implemented, e.g.
:g/pattern/d | Delete all lines containing pattern |
:g/pattern/y | Yank all lines containing pattern |
:g!/pattern/p | Print all lines not containing pattern |
Back to the top
Last update: August 15th 1999 by Gerhard Bürgmann
|