Copyright: WinXs ® 1995 Mick Meaden


Contents

Introduction

This program provides a common framework for the execution of a number of general UNIX utilities.  In particular, it provides a Single Document Interface (SDI), with common menu commands, display facilities and printing services.  The program can be invoked directly from Program Manager; the utilities can be invoked individually from the WinXs menu in File Manager, or from menus in the WinXs shell (32-bit version).

Utilities

cmp

csplit

diff

du

file

grep

sed

split

strings

tail

wc

See Also

Menus


cmp

NAME

cmp - binary file comparison

DESCRIPTION

This program peforms a binary comparison of the two named files and displays a single line indicating either:

•	the byte and line number of the first bytes that differ, or

•	a line indicating that the files are identical.

SEE ALSO

dialog


Dialog

The Diff for Windows dialog box presents the following options

File1

File2

Names of the files to be compared.  If this program is invoked from the WinXs menu in File manager, and a file is currently selected, the name of that file will appear in "File1".  If it is invoked from the WinXs shell, then the first two selected files (if any) will appear in "File1" and "File2" respectively.

Browse1

Browse2

Invoke the standard Windows open file dialog for "File1" and "File2" respectively.

Ignore Case

If checked, the case of letters is ignored during comparison.  This option does not apply to cmp(1).

Ignore White-Space

If checked, tabs and spaces are compressed during comparison; that is, if a line contains many tabs or spaces, diff(1) treats these characters as a single space.  This option does not apply to cmp(1).

Type

These radio buttons determine which type of file comparison should be performed; that is, using cmp(1) or diff(1).  The appropriate button will be preset when the program is invoked from the WinXs menu in File Manager.


Csplit

Name

csplit - split files based on context

Description

The csplit utility reads the named input file and separates it into n+1 sections, defined by the arguments arg1...argn in the Arguments list.  By default, these sections are written to files xx00...xxn, as follows:

  xx00  From the start of the input file to the first
        argument in the Argument list (arg1).

  xx01  From arg1 to the second argument in the Argument
        list (arg2)
  ...
  xxn   From the last argument in the Argument list (argn)
        to the end of the input file

Both the prefix of output files (xx) and the number of decimal digits (00...n) can be changed.

Operands

FIlename

Specifies the name of the input file.  Only one filename can be passed to each invocation of this program and it cannot contain DOS wild-card characters.  Select a new or different filename by using the associated Browse button.

Arguments

This field provides the context on which file splitting will be based, as a series of space separated arguments.  The following argument types are  accepted by this version of csplit:

•	/regexp/[offset]	Create a file using the contents of the lines from the current line up to, but not including, the first line that matches "regexp".  The syntax of regular expressions accepted by this utility is the same as that defined for the Grep utility.  The optional offset is a positive or negative integer, representing a number of lines after (+) or before (-) the matched line, to be included in or excluded from the output file.  If this causes the resulting file to have zero size, the offset is ignored.  After an output file is created, the current line is set to the next unwritten line in the input file.

•	%regexp%[offset]	This is the same as the previous argument, except that no output file will be written for the selected section of the input file.

•	line_no	Create a file from the current line up to, but not including, the line number "line_no".  Lines in the input file are numbered starting at one.  After an output file is created using this type of argument, the current line becomes "line_no".

•	{num}	Repeat the previous argument "num" times.  This argument can follow any of the argument types described above.  If it follows a "regexp" type argument, that argument will be applied "num" more times.  If it follows a "line_no" argument, the input file will be split every "line_no" lines, "num" times, from that point.

Options

•	Prefix.	Name the output files "prefix00", "prefix01", etc..  The default prefix is "xx".

•	Digits in Filenames.    Use the specified number of digits when creating output files (the default is 2).

Examples

An argument list containing "/^}/+1 {n}" will split a C source file into a section for each function definition, where "n" is some suitably large number.

An argument list containing "50 {10}" will split a file into 1 file of 49 lines (there is no line number zero) and 10 files each of 50 lines.  If the input file contains more than 549 lines, the last file will contain line numbers 550 to end-of-file.


diff

NAME

diff - text file comparison

DESCRIPTION

This program will compare the contents of two text files and display the results in the output window.  Various options can be set via checkboxes presented in the main dialog (see below).

Output is in the form of one or more UNIX-like context editing commands which take the form:

<range><action><range>

where <range> may contain a single line number or a comma-separated line range (e.g., 2,4).  A line number or range appearing before the action refers to lines in "file1", while those appearing after <action> refer to lines in "file2".

The <action> is a UNIX-like editor command, which will be one of "a" (append lines), "d" (delete lines), "c" (change lines).  The aim of these is to identify what editor commands would need to be used to convert "file1" to "file2".

Following each of these lines, diff will display all lines affected in the first file preceded by a '<' character, followed by all lines affected in the second file preceded by a '>' character.  If there are lines affected in both files, as with the "c" command, the changes are separated by a line consisting of three hyphens ("---").

SEE ALSO

dialog


Du

Name

du - estimate file space usage

Description

This program is a Windows-based implementation of the UNIX du(1) command, which displays the amount of disk space occuppied by files and directories.  Operation begins at the current directory, or in the directory given as a command argument (if any), and proceeds through all subfiles and subdirectories.  Optionally, the command can be directed to list the size of each subfile, or output can be limited to subdirectories only.  The final line of output gives the total number of blocks occuppied by this directory and all its descendents.

Output consists of a series of text lines, one per file/directory, each giving the size of a file/directory in 1024 or 512 byte units and the name of the file/directory.  Menu options permit output to be copied to the Windows clipboard or sent to a printer.

Operands

Directory

Identifies the directory at which the output listing will begin.  This value can be changed by double-clicking a directory in the directory listbox.

List All Files

If checked, this option causes all subfiles and subdirectories to be included in the output.  By default, only subdirectories are listed.

Exclude Subdirectories

If checked, this option prevents subdirectories being included in the output, meaning that only a total for all subfiles and subdirectories will be listed.

Show Utilization

If checked, this option causes a space utilization figure to be displayed after the block count, as a percentage of used space versus allocated space.

On FAT file-systems, space is allocated in fixed units which grow with the size of the disk partition holding the file-system.  Minimally this unit size is 2kb, but can grow to as large as 32kb on 1.0 gigabyte partitions.  The upshot of this is that large amounts of disk space may be wasted as a result of large allocation units.  Use this option to check how much wasted space is accumulating on your file-systems (the lower the percentage, the more space is being wasted).

There are various ways to improve the utilization figure. One way is to reformat your disk with a number of smaller partitions; another way is to use DriveSpace (or equivalent) to create compressed partitions within a large non-compressed partition (the allocation unit size for DriveSpace is typically 8kb).  This second solution also has the advantage of using disk space more effectively.

Units

This controls the units in which file/directory sizes will be displayed; that is, 1024-byte (the default) or 512-byte.


File

Name

file - determine file type

Description

The File utility performs a series of tests on each specified file in an attempt to determine its contents.  This version of File checks the following:

1 	If the files extension (.ext) is registered in the Windows Registration Database, then the associated registration database description is used to identify the file.

2 	The intial segment of the file is examined and its contents are matched against a series of magic numbers built into the File program.  If a match is found, this is used to identify the file.

3 	If all else fails, a simple test is performed to determine if the file is an ASCII text file or a data file (i.e., of completely unknown type).

The efficacy of this utility is largely dependent on the contents of the Windows registration database; that is, systems with large numbers of registered applications are more likely to produce accurate results than systems with only a few.  Note also that when a matching entry is found in this database, the associated text will be used to identify the file.  This can sometimes be terse, and often is simply the name of the executable file used to process the file.

Magic numbers provide a second line of attack.  These are a series of built-in database entries that identify a file offset and a value which, if present at that offset, will uniquely identify the contents of the file.  This database can be expected to grow with time.

Unlike the UNIX version of file(1), no attempt is made to distinguish program text from English language text, partly because these checks often produce the wrong results, and also because the text of other natural languages cannot always be discerned according to the rules of the English language.

Operands

File(s)

One or more filenames (possibly containing DOS wild-card characters) identifying the file or files to be checked.  Multiple filenames appearing in this field should be separated by space characters.

Current Directory

Identifies the current working directory, which can be changed by double-clicking a directory name in the associated listbox.  Drives can be changed by double-clicking a drive name.

Check Magic First

To try and identify the contents of each file, File will normally check the Windows Registration Database for a matching file extension; if this fails, it will then scan the magic number database.  Checking this option reverses the order in which these databases are used, so the magic number database is checked first, followed by the Windows Registration Database.  This is useful, for example, when looking for UNIX files stored in a specific format (e.g., compressed).

Debug

Because the results produced by this utility can sometimes be puzzling, File provides a mechanism through which users can determine how those results are being reached.  Selecting the button marked None (the default), prompts File to perform normal file checking.  Selecting "Registration" causes the contents of the Windows registration database to be displayed, and selecting "Magic numbers" causes the built-in database of magic values and offsets to be displayed.

Output

Debug=None

Each checked file is displayed on a separate line in the form:

<filename>: <description>

where the <description> identifies the contents of the file.

Debug=Registration

File performs a serial scan of the Windows registration database and produces one line for each entry in the database with an extension (.ext) as its key.  Output is in the form:

<.ext> <ClassName> <ClassDescription>

where <ClassName> is an application-defined string that identifies the registration class with which <.ext> is associated, and <ClassDescription> is the ASCII text string associated with <ClassName>.  Either or both <ClassName> and <ClassDescription> can be blank.

Debug=Magic Number

File lists the contents of the built-in magic number database in the form:

<offset> <length> <magic number> <description>

where <offset> is the file offset, in bytes, at which to check for a <magic number> of <length> bytes.  <description> is the text string that will be output by File when a match is found.


Grep
Contents

Name

grep - search a file or files for a pattern

Description

Grep for Windows searches one or more files for a matching sequence of characters (the search pattern), which is specified as a simple regular expression.  The name of each searched file is displayed in the output window, complete with lines that matched the search pattern (if any).  Optionally, each matching line can be preceded by its line number within the file.

Grep can be invoked either from Program Manager or from the WinXs menu in File Manager.  The extension of the first file selected in the File Manager file window (if any), with the filename part replaced by the "*" wild-card character, is passed to Grep as the name of the file(s) to be searched.  The user must fill in remaining fields of the search dialog box before searching can begin.

See Also

Regular expression

Search Dialog

Menus


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>.

\t	(WinXs extension)  A backslash character followed by the letter 't' matches a <tab> character.  This metacharacter is necessary in a Windows environment because a <tab> character cannot be entered directly into a field within a dialog control.

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).


Search Dialog

Filenames

The name of one or more files to be searched.  If DOS wild-card characters are specified, filename expansion will occur automatically.  Multiple filenames appearing in this field should be separated by space characters.

Patterns

Specifies one or more regular expressions separated by newline characters.  Grep will search the specified files for lines that contain (or do not contain) a character sequence matching one of the specified patterns.

Regular Expression

Flags

Specifies the option flags for this search operation.

Option Flags

Directory

Specifies the directory containing the file or files specified by Filenames.  The search directory can be changed by double-clicking a directory name or a drive name in the associated list box.


Option Flags

Ignore Case

The case of characters is ignored during searching.  For example, the letters "A" and "a", "B" and "b", etc. are considered equal.  Thus a search for all words beginning with the letter "A" would match "alpha", "Albert", etc..

Display Line Numbers

Matching lines in the output window will be preceded by their relative line number within the file that contains them.  This is only meaningful for text files.

Descend Subdirectories

If checked, Grep will search the current directory and all its subdirectories for files that match the input filespec or partspec.  Otherwise it will  only check files in the current directory.

Display Unmatched Lines

Normally Grep displays lines that match the specified regular expression.  If this option is checked, however, it displays only those lines that DO NOT match the specified regular expression..


Menus

File Menu

New

Restart the current utility with a new set of options.

Save As...

Save results to a file.

Switch to...

Switch to another utility in this package.

View

View selected file.  Select a filename anywhere in the output window (e.g., by double-clicking the left mouse button over the appropriate name) and then select this item to pass the filename to more for viewing.

Print

Send the contents of the current output display, or the current selection, to a printer.

Print Preview

Preview the output display for printing.

Print Setup

Invoke the standard Windows printer setup dialog.

Exit

Terminate the program and return to Windows.

Edit Menu

Copy

Copy the current selection to the WIndows clipboard.

Help Menu

Contents

Go to the contents topic associated with this help file.

About

Display program name, copyright statements and program version number.


Sed
Contents

Name

sed - stream editor

Description

The sed utility is a stream editor that reads one or more text input files, makes editing changes under the control of an editing script, and writes the results to a single named output file or back to the original input files.

Limits

Operands

Input File(s):

One or more filenames (possibly containing DOS wild-card characters) naming the input file or files.  Multiple filenames appearing in this field should be separated by space characters (e.g., "foo.bar *.txt x*).

Note.  When multiple input files are specified, line numbering restarts at 1 for each file.  This is different to the UNIX sed(1) command, which treats multiple files as a single input stream and logically concatenates them together (such that there is only one line number 1).  If this effect is required with the WinXs tools, first concatenate the input files using the cat(1) filter and then process the output file as a single entity.

Output file (Optional):

A filename identifying the output file.  The input files will be appended to this file (if specified), preserving its original contents.  If this field is blank, the processed output will be written back to the original input file(s).

Current Directory:

Contains the name of the current working directory, which can be changed by double-clicking a directory name in the associated listbox.  Drives can be changed by double-clicking a drive number; double-clicking a filename causes that name to be added to the "Input File(s)" field described above.

Suppress Default Output:

Normally each input line is written to the output file after all editing commands have been executed for that line.  Checking this option suppresses that behaviour , such that the only lines sent to the output file will be those written explicitly by commands like 'p', 'P', 'l' and '='.  This is equivalent to the '-n' command line option in the UNIX version of sed.

Development Mode:

After sed has successfully applied the editing script to all input lines, it will terminate and return control to the calling program (normally the Windows Program Manager or File Manager).  Checking this option overrides that behaviour such that control is returned to the sed dialog, allowing the various dialog fields to be modified and the script to be re-run.  When this mode is applied, 'cancel' must be selected to close the dialog.

Paste From...

Brings up the Windows Open dialog, which allows a text file containing a sed script to be opened and read into the "Script" field described below.

Copy To...

Copies the current contents of the "Script" field to a named output file.  The contents of this file can be reloaded at any time using the "Paste from..." facility described above.

Script:

This is a multi-line edit control that can be used to enter and modify the editing script.  Normal Windows key sequences apply in this control, e.g.,

Ctrl+C	Copy currently selected text (to the clipboard).
Ctrl+V	Paste text from the clipboard.
Ctrl+X	Cut currently selected text.

The script consists of editing commands, one per line, of the following form:

[addr[,addr]] command [arguments]

Zero or more blank characters are accepted before the first address and before the command.

In default operation, sed cyclically copies a line of text, less its terminating newline character, into a pattern space, applies in sequence all commands whose addresses select that pattern space, and at the end of the script copies the pattern space to the named output file and deletes the pattern space.  Whenever the pattern space is written to the output file, sed will immediately follow it with a newline character.

Some of the commands also use a hold space to save all or part of the pattern space for subsequent retrieval.

Addresses

Regular Expression

Commands


Limits

The following numerical limits are imposed by the implementation:

Maximum size of pattern space	8192 bytes
Maximum size of hold space	8192 bytes
Maximum size of input line	512 bytes
Maximum size of file for 'r' command	32768 bytes
Maximum size of editing script	32768 bytes
Maximum no of lines in script	1024
Maximum no of input files	500
Maximum size of input file(s)	Unlimited
Maximum size of output file	Unlimited


Addresses

An address is either empty, a decimal number that counts input lines within each input file, a $ character that addresses the last line of an input file, or a context address (which consists of a regular expression preceded and followed by a delimiter, usually the slash character).  A command line with no addresses selects every pattern space; a command line with one address selects each pattern space that matches the address.

A command line with two addresses selects the inclusive range from the first pattern space that matches the first address, to the next pattern space that matches the second address.  Starting at the first line following such a range, sed looks again for the first address.  Thereafter the process is repeated.

Editing commands can be applied only to non-selected pattern space by use of the negation command ! (see editing commands for more detaills).  For example:

20	selects input line number 20
200,$	selects lines 200 to end-of-file
/^$/	selects all blank lines
/^$/!	selects all non-blank lines
/{/,/}/	select ranges starting with '{' and ending
with '}'.

Sed supports standard regular expression syntax with the following additions:

•	In a context address, the construction '\cREc', where 'c' is any character other than a backslash or newline character, is identical to '/RE/'.  For example '\%foo%' is equivalent to '/foo/'.

•	The escape sequences '\n' and '\t' match a newline character and a tab character respectively.

Regular Expression


Commands

In the following list of commands, the maximum number of permissible addresses for each command is indicated by [0addr], [1addr] or [2addr], representing zero, one or two addresses respectively.  The argument 'text' consists of one or more lines, where each embedded newline character in the text must be preceded by a backslash; other backslashes in the input are ignored.

[2addr] { command-list }

Execute each command in the command-list when pattern space is matched by [2addr].  command-list is a list of sed commands seperated by newline characters as follows:

{
command
command
...
}

Each command may be preceded by blank characters (space or tab) and can be followed with white space.  The terminating '}' character must be preceded by a newline character and (optionally) zero or more blank characters.

[1addr] a\

text

Write 'text' to the output file just before each attempt to fetch a line of input, whether by executing the 'N' command or by beginning a new cycle.

[2addr] b [label]

Branch to the ':' command bearing the 'label'.  If 'label' is not specified, branch to the end of the script.

[2addr] c \

text

Delete the pattern space.  With 0 or 1 address, or at the end of a 2 address range, write 'text' to the output file.

[2addr] d

Delete the pattern space and start the next cycle.

[2addr] D

Delete the initial segment of pattern space, up to and including the first embedded newline character, and restart the script from the beginning.  This command behaves the same as 'd' if there is no embedded newline character.

[2addr] g

Replace the contents of pattern space by the contents of hold space.

[2addr] G

Append a newline character to pattern space, followed by the contents of hold space.

[2addr] h

Replace the contents of hold space with the contents of pattern space.

[2addr] H

Append a newline character to hold space, followed by the contents of pattern space.

[1addr] i \

text

Write 'text' to the output file immediately.

[2addr] l

The letter ell.  Write pattern space to the output file in a visually unambiguous form.  The characters \\, \a, \b, \f, \r, \t and \v will be written as the corresponding escape sequence (\n is not applicable).  Other non-printable characters will be written as a 3-digit octal number with a preceding backslash.

[2addr] n

Write pattern space to the output file if 'suppress default output' is not selected, and replace pattern space with the next line of input.

[2addr] N

Append a newline character to pattern space followed by the next line of input.  Note that the current line number changes.

[2addr] p

Write the contents of pattern space to the output file.

[2addr] P

Write the contents of pattern space, up to and including the first embedded newline character, to the output file.  This command behaves like 'p' if there is no embedded newline character in pattern space.

[1addr] q

Branch to the end of the script and quit sed without starting a new cycle.

[1addr] r rfile

Copy the contents of 'rfile' to the output file just before attempting to read the next line of input.  If 'rfile' does not exist or cannot be read, it is treated as if it were an empty file and no error occurs.

[2addr] s/regular-expression/replacement/flags

Substitute the 'replacement' string for instances of 'regular-expression' in pattern space.  Any character other than backslash or '&' can be used instead of slash to delimit the various fields.

An ampersand (&) appearing in the 'replacement' string causes substitution of the string matching the 'regular-expression'.  This special meaning of '&' can be suppressed by preceding it with a backslash.  Newline and tab characters in 'replacement' can be specified by the escape sequences '\n' and '\t' respectively; an occurrence of backslash followed by any other character is treated literally and the backslash itself is substituted.

The value of 'flags' can be zero or more of:

n	Substitute the 'n'th occurrence of the regular expression found within pattern space, where 1 is the first such occurrence, 2 the second , and so on.  (default 1).

g	Globally substitute for all non-overlapping instances of the regular expression rather than just the first.  If both 'g' and 'n' are specified, 'g' is ignored.

p	Write the contents of pattern space to the output file if  a replacement was made.

w wfile	Append the contents of pattern space to 'wfile' if a replacement was made.

[2addr] t label

Test.  Branch to the ':' command bearing 'label' if any substitutions have been made since the most recent reading of an input line or execution of a 't' command.  Branch to the end of the script if 'label' is not specified.

[2addr] w wfile

Append pattern space to 'wfile'.

[2addr] x

Exchange the contents of pattern space and hold space.

[2addr] y/string1/string2/

Replace all occurrences of characters in 'string1' with the corresponding characters from 'string2'.  Any character other than backslash or newline can be used instead of slash as a field delimiter.

[2addr] ! command

[2addr] ! { command-list }

Apply the command or command-list only to lines that are not selected by the addresses.

[0addr] : label

This command does nothing, other than bear a label for the 'b' and 't' commands.

[1addr] =

Write the number of the current line, followed by a newline character, to the output file.

[0addr]

An empty line is ignored.

[0addr] #

Comment.  The remainder of the line is ignored, with the single exception that if the first line of the script contains '#n', default output is suppressed (i.e., this is equivalent to checking the 'suppress default output' option).


Split

Name

split - break a file into separate pieces

Description

This utility reads an input file and writes one or more output files.  The default size of each output file is 1000 lines.  The size of output files can be modifed by specifying ouput files of different units (lines, bytes, kilobytes or megabytes), and different numbers of units/file.

Each output file is created with a different suffix.  The suffix consists of 3-letter sequences, incremented as if they were base-26 numbers.  For example, using the default suffix "xaa", the first output file will be named "<file>.xaa", the second will be "<file>.xab", and so on to "<file>.zzz"; where <file> is the same as the input filename.

If the number of files required exceeds the maximum allowed value of the suffix (i.e., ".zzz"), Split will fail when it tries to create the next output file.  Files already created by the operation will be left intact.

This version of the program also provides an Unsplit facility, which allows output files generated by a previous Split operation to be formed back into a single large file.

Operands

Filename

Specifes the pathname of the input file (Split), or the pathname of the file to be generated (Unsplit).  Output filenames will be generated using the file-prefix from this name and starting at the extension value given below.  For example, if the input filename is "bigfile.txt", output filenames will start at "bigfile.xaa", increasing by 1 up to the last required filename ("bigfile.zzz" being the absolute limit).

Extension

The 3-character extension to use when generating output filenames, or the starting extension for Unsplit operations.  By default, this value is set to "xaa".

Type

Identifies whether this is a Split or an Unsplit operation (Split by default).

Units (Split Only)

Indicates the unit type (for splitting operations) and the maximum number of units to be written to each output file.  Units may be either Lines, Bytes, Kilobytes or Megabytes.  The units/file value will be scaled according to which of these unit types is selected.


Strings

Name

strings - find printable strings in a file or files

Description

Ths Strings utility looks for printable strings in any type of file and displays those strings in the output window.  A printable string is defined as a sequence of four (by default) or more printable characters terminated by a newline or NUL character.  This command is often used on UNIX systems to locate copyright statements in object files, or to extract error messages.

By default, Strings will search for sequences of 4 or more printable characters.  This value can be changed by the user, and the displayed lines can optionally be preceded by their offset in the input file, displayed in decimal, octal, or hexadecimal format.

Operands

File(s):

One or more filenames (possibly containing DOS wild-card characters) identifying the file or files to be scanned.  Multiple filenames appearing in this field should be separated by space characters.

Current Directory:

The drop-down listbox can be used to select a file or directory.  Double-clicking a file in the listbox causes that filename to be added to the "File(s):" field; double-clicking a directory name causes that directory to become the current working directory, and its name to be displayed in the "Current Directory:" field.

String Length:

By default, Strings will look for printable strings of 4 or more characters.  This value can be changed by typing a different number in this field.

Offsets In:

Allows the file offset of located strings to be displayed in decimal, octal, or hexadecimal format.  By default, file offsets are not displayed.


tail

Name

head - Display the first part of a file
tail - Display the last part of a file

Description

These utilities display the first part or the last part (respectively) of one or more text files.  In the case of Head, it is also possible to skip the first N lines in a file, thus allowing the mid sections of a file or files to be displayed.

Typically, Tail is used to display such things as the latest entries in log files; Head can be used to display selected pieces of text from very large files such as dictionaries.

Operands

File(s):

One or more filenames (possibly containing DOS wild-card characters) identifying the file or files to be processed.  Multiple filenames appearing in this field should be separated by space characters.

Current Directory:

The drop-down listbox can be used to select a file or directory.  Double-clicking a file in the listbox causes that filename to be added to the "File(s):" field; double-clicking a directory name causes that directory to become the current working directory, and its name to be displayed in the "Current Directory:" field.

No of Lines:

Specifies the number of lines to be displayed in each input file (default 10).

Skip Lines:

If Head is selected, specifies the number of lines to be skipped in each input file before displaying the number of lines indicated by "No of Lines:".  This is useful for displaying the mid sections of a file.  The contents of this field are ignored if Tail is selected.

Program:

•	Head.  Display the first "No of Lines:" in each input file, optionally skipping over "Skip Lines:".

•	Tail.  Display the last "No of Lines:" in each input file.


Wc

Name

wc - count words, lines and bytes in a file or files

Description

This program is a Windows version of the UNIX wc(1) command, which counts the lines, words and bytes in one or more text files.  A separate set of counts is produced for each file scanned, which are totalled at the end of the output display.  Output is in the form:

<lines> <words> <bytes> <filename>

Optionally any or all of <lines>, <words> and <bytes> can be omitted.

Operands

Filenames

One or more filenames (possibly containing DOS wild-card characters) identifying the file or files to be scanned.  Multiple filenames appearing in this field should be separated by space characters.

Directory

Specifies the current working directory.  This can be changed by double-clicking a directory name in the directory window.

Count Lines

If checked, causes the number of lines in each file to be output; or, more accurately, the number of newline characters encountered.

Count Words

If checked, causes the number of words in each file to be output.  Words are considered to be delimited by white-space, tab and newline characters.

Count Bytes

If checked, causes the number of bytes in each file to be output.


FileCompare
Contents

Introduction

This program provides various mechanisms for comparing the contents of two files, as follows:

•	Binary comparison.  This provides a Windows implementation of the UNIX cmp(1) command, which performs a binary comparison of two files and identifes the first line and byte position at which they differ (if any).

•	Text comparison.  This provides a Windows implementation of the UNIX diff(1) command, which will compare the contents of two text files and list the differences in terms of UNIX-like editor commands.

Whichever command is chosen, results are displayed in the output window, which is a readonly Edit Control that can be scrolled, copied or printed.

Procedures

On invocation, the user is presented with a dialog box that names the files for comparison and defines various options for controlling how the files are compared.  This dialog can be re-invoked at any time by selecting the New option on the File menu.

Reference

cmp

diff

Dialog

Menus