BVI: Search Commands

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 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\0`RETURN 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 12`RETURN, 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/p`RETURN or `:g\hex_pattern\p`RETURN 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: Thu Jun 01 12:00:00 CEST 2000 by Gerhard Bürgmann