Copyright: Copyright ® 1995 Mick Meaden


Contents

Name

hd - display a file in hexadecimal format

Description

Hd is a WIndows SDI (Single Document Interface) application that allows files of any type and size to be viewed in hexadecimal format.  The movement commands are compatible with More and permit full-page, half-page or line scrolling.  Hd also supports regular expression searches, line tagging (bookmarks), printing and print previewing.

Output is in the form of a series of lines in the following format:

<decimal offset> <hexadecimal offset> <hexadecimal codes> <ASCII codes>

where "offset"s are file offsets, and the ASCII codes are defined for character values in the range 0x20 to 0x7F.  Character values outside this range are displayed as a dot (.).

This program can be invoked directly for Program Manager or from the WinXs menu in File Manager.

See Also

Movement Commands

Printing

Regular Expressions

Searching

Text Marks

Menus


Movement Commands

The following movement commands can be selected when a window has input focus:

Menu Item              Key             Meaning

Start-of-File	HOME            Skip to first line in file
End-of-File	END             Skip to last line in file

Page Forward	f (PgDn)        Scroll forward one screen
Page Backward	b (PgUp)        Scroll backward one screen
Half-page Forward	d (right arrow) Scroll forward half a screen
Half-page Backward	u (left arrow)  Scroll backward half a screen
Line Forward	j (down arrow)  Scroll forward one line
Line Backward	k (up arrow)    Scroll backward one line

Search Forward	/               Search forward for text
Search Backward	?               Search backward for text
Repeat	n               Repeat last search
GoTo                   g               Jump to specific line

Skip to Mark	'               Jump to specific text mark

Searching

Text Marks


Searching

Searching can be either forward or backward and is performed by matching a specified regular expression against the text as it appears when displayed.  Searches are initiated by selecting Search Forward, Search Backward or Repeat on the Search Menu.  In the first two cases, the Search Dialog is displayed; in the latter case, the previous search (if any)  is repeated.  Searching stops at the first line containing a text pattern that matches the regular expression; that line is then displayed as the first line in the output window.

Regular Expression

Search Dialog

The following options are presented in the search dialog:

Regular Expression

A single or multi-character regular expression identifying the text to search for.

Anchor at start-of-line

Same as the caret (^) single-character regular expression; that is, the search will only match with text at the start of an input line.

Anchor at end-of-line

Same as the dollar ($) single-character regular expression; that is, the search will only match text at the edn of an input line.

Ignore Case

The case of characters is ignored when matching text; that is, the upper-case letters will match their lower-case equivalents, and vice versa.


Regular Expression

A regular expression is made up of ordinary characters and metacharacters.  An ordinary character matches itself; for example, the re "aardvark" matches the character sequence <a><a><r><d><v><a><r><k> anywhere in an input line.  A metacharacter or metacharacter sequence has special meaning as described below.

Metacharacters

 .	A dot (.) matches any character.  For example, the re "ab." matches the character sequence <a><b><any-character>.

 *	An asterisk (*) matches the previous ordinary character, metacharacter or metacharacter sequence any number of times.  For example, the re "ab.*" matches the character sequence <a><b><any-character...>.

 \	A backslash (\) escapes the following character and is commonly used to escape the meaning of a metacharacter.  For example, the re "ab\." matches the character sequence <a><b><.>.

\n	This expression matches the same string of characters as was matched by the nth expression enclosed between the metacharacter sequence \( and \) (see below for details), appearing earlier in the same regular expression. For example, the re "^\(abc\)\1$" matches a line consisting of two repeated appearances of the string <a><b><c>.

 ^	A caret (^) anchors a regular expression at the start of an input line.  For example, the re "^abc" will only match input lines that start with the character sequence <a><b><c>

 $	A dollar ($) anchors a regular expression at the end of an input line.  For example, the re "abc$" will only match input lines that end with the character sequence <a><b><c>.

Metacharacter Sequences

 [...]	A bracketed re is a metacharacter sequence that defines a scanset.  A scanset defines single characters or character ranges that are matched against the next character in the input line.  For example, the re "^[abc]" will match any input line that begins with the characters <a>, <b> or <c>.  A character range is denoted by dash (-) separated character sequences; that is, the re "^[a-z]" matches any line beginning with a lower-case letter, the re "^[a-zA-Z]" matches any line beginning with a lower-case or an upper-case letter.  Within scansets, metacharacters, other than a dash, lose their special meaning.  A dash character appearing as the first or last character in a scanset loses its special meaning and matches itself.  A caret (^) appearing as the first character in a scanset causes the scanset to be complemented; that is, the re will match characters NOT specified in the scanset.

\{m,n\}	Is a range expression that matches the previous ordinary character or metacharacter a specified number of times.  The values of m and n must be integers in the range 1-255.  The expression \{m\} matches exactly m occurrences; \{m,\} matches at least m occurrences; \{m,n\} matches any number of occurrences between m and n inclusive.  Wherever a choice exists, the re matches as many occurrences as possible.

\(re\)	An re enclosed between \( and \) matches whatever the unadorned re matches.  However, the enclosed re can also be used for repeating a match (see \n above).


Text Marks

Text marks (or bookmarks) are a way of marking specific positions within the file being viewed.  Hd permits 26 such marks, each one identified by a single letter in the range a-z.  Generally speaking, text marks can be used wherever line numbers may be specified.  They are also useful for marking specific positions in displayed text, which can be jumped to subsequently by simply specifying the associated text mark.

To display or clear current text marks, select Show All Marks on the Search Menu.


Printing

Hd for windows supports printing and print previewing.  The text will be rendered on the printer exactly as it is displayed in the view window.  Each page is printed with a header as defined for the UNIX pr(1) command; that is, date and time of printing, filename and page number.

Note that long lines are truncated rather than wrapped.  Also, either the whole document or a subrange of pages can be printed.


Menus

File Menu

Search Menu

Commands Menu

Help Menu

Contents

Displays the contents topic of this help file.

About

Displays program name, version number and copyright statements.


File Menu

Open

Opens a new file for viewing.  Because Hd is an SDI application, the current file (if any) is closed before opening the new file.

Save As

Writes the current active document as displayed (i.e., in hexadecimal dump format) to a text file.  Note that these files can be very large.

Print

Print the current file via Print Manager.

Print Preview

Preview the current file as it will appear when printed.

Print Setup

Invoke the standard Windows print setup dialog.

Exit

Quit this program and return to Windows.


Search Menu

Search Forward

Search Backward

Search forward/backward in the file, starting at the line displayed at the top of the current screen, for a line containing the specified regular expression.  If a matching line is found, it will be displayed at the top of the next output screen.

Searching

Regular Expressions

Repeat

Repeat the last search, in the same direction.

Set Mark...

Skip to Mark...

Text Marks

Show all Marks

Displays a listbox identifying all current text marks and the lines to which they refer.  Optionally, all current text marks can be cleared.

GoTo

Jump directly to the specified (decimal) byte offset.


Commands menu

Page Forward

Page Backward

Scroll forward/backward one screenful.  The length of a screen depends on the current window size and the length of displayed lines.

Half-page Forward

Half-page Backward

Scroll forward/backward one half screenful.  In effect, Hd will scroll to the middle of the current screen (forward) or the middle of the previous screen (backward).

Line Forward

Line Backward

Scroll forward/backward one line, starting from the line at the top of the current screen.  Note that this means whole line scrolling, which may result in the scrolling of one or more screen lines.

Start of FIle

End of FIle

Jump to start/end-of-file.  In the case of end-of-file, only the last line of the file will be displayed on the output screen.