HEAD {outfile=}<wildspec> {switches}
HEAD is similar to the eponymous UNIX command and is used to display or copy to another file the first N lines of a specified file or wildcard list of files.
Switches
Switch |
Function |
/D{elete} |
Delete: required when an output file is specified that already exists. |
/L{ines}:### |
Lines: specifies the number of lines to copy or display. Default is 20. |
/Q{uery} |
Query: prompts for confirmation on each file. |
/? |
Writes switch listing and usage info to the screen. |
Examples
This example displays the first twenty lines of the specified file (more or less equivalent to using PAGE TYPE <file> to display one screen-full and then aborting.
.HEAD SYS:ERRMSG.USA
This next example is similar, except it uses quotes to refer to a native host operating system file specification (note that they are case sensitive under UNIX) and also uses the /L:5 switch to limit the display to the first five lines:
.head "/vm/miame/miame.ini" /L:5
This next example creates a file called verdir.txt, which consists of the first line of each BASIC source file in the current project. Assuming you adopted a standard of putting something meaningful and consistent on the first line of each source file, this could be a very useful way to compare two sets of source files (i.e. use the command below on each set of files, then sort the resulting header files and compare them using SRCCOM).
.head verdir.txt=*.bas[,*]/l:1/d
See the notes on TAIL for the same idea only counting from the end of the file.
History
2022 June, A-Shell 6.5.1717, HEAD.LIT 3.4(107): Updated to fix a very old bug which would result in the directory listing being duplicated if there were consecutive DEVICE statements for the same device—i.e. one normal DEVICE definition and one or more PPN-specific definitions.