AminetAminet
Search:
84510 packages online
About
Recent
Browse
Search
Upload
Setup
Services

util/cli/heads.lha

Mirror:Random
Showing:m68k-amigaosppc-amigaosppc-morphosi386-arosi386-amithlonppc-warpupppc-powerupgeneric
No screenshot available
Short:AREXX for first/last/both ends of a file
Author:Herbert Wollman hwollman at mitre.org
Uploader:Herbert Wollman hwollman mitre org
Type:util/cli
Requires:util/libs/rexxarplib.library
Architecture:m68k-amigaos
Distribution:All
Date:1995-11-17
Download:http://aminet.net/util/cli/heads.lha - View contents
Readme:http://aminet.net/util/cli/heads.readme
Downloads:543

Heads.doc    Documentation for head, tail, and ends
3 AREXX programs for viewing the first/last/both ends of a file.

Herbert Wollman,  Telephone (617) 272-2994
5 Fowler Ter, Burlington, MA 01803, USA.
E-mail at hwollman at mitre.org

Head and tail are handy utilities for viewing the first and last lines 
respectively of files.  They are a standard part of any UNIX computer, and 
have been ported to many other computer systems.  Their default behavior is 
to copy the first (or last, respectively) 10 lines from Standard Input to 
Standard Output.  However, like most UNIX commands, command line options 
can make them much more versatile. The usage is,

head [ -LineCount ] [ File ] [ OtherFiles... ]
tail [ -LineCount ] [ File ] [ OtherFiles... ]
ends [ -LineCount ] [ File ] [ OtherFiles... ]

If the first command line parameter is a negative integer, it will specify 
the number of lines copied.  If the LineCount parameter is missing, it will 
default to 10.  Any other parameters are the names of files to read instead 
of Standard Input.  If more than one file is specified, the filename will 
appear before each new set of lines listed. 

Head and tail are standard utilities, usually written in C, available on all 
UNIX computers.  My Amiga versions, head.rexx, and tail.rexx included in 
this archive are written in AREXX.  Head.rexx is functionally identical to 
the version I use at work on Silicon Graphics workstations.  The UNIX 
version of tail allows only one file to be specified, but my Amiga version 
allows multiple files, just as head does.  

Occasionally you want to view both the beginning and end of a file.  For 
this I have written the program ends.rexx, which has no direct UNIX 
equivalent.  The syntax for ends is the same as for head or tail.  It will 
show the first and last lines of each file, separated by a line of ...

On a UNIX computer the shell expands wildcards in the filenames on the 
command line prior to passing it to a program.  Hence the head program 
would receive one command parameter for each file that it has to read.  
However, on the Amiga, neither the standard AmigaShell, nor the WShell 
(which I use), perform wildcard expansion.  Therefore each program must do 
its own filename expansion.  To do this, I use the FileList() function in 
the rexxarplib.library, which must be located in the LIBS: directory.  

I have included two smaller and faster versions of head, which only perform 
the default operation, and hence do not accept command line options.  
Defhead.rexx (Defaulthead) is a 2 line, 158 byte program in AREXX.  In 
contrast, the full version of head.rexx, which can handle any number of 
filename patterns on the command line, each of which can expand into many 
names, is relatively large, i.e., 1290 bytes, and 59 lines.  

Fhead.f is the one line source code for Fhead (Falsehead), which is written 
in "False."  The compiled executable is only 312 bytes.  False is a 
wonderful "toy" language written by Wouter van Oortmerssen, and available 
on Fish Disk 885.  It is perfect for this type of application, at least if 
you like compact obscure code.  

All of the program files in this archive are released into the public 
domain, however I request that if you redistribute them, please keep them 
together with this doc file.  If you wish to contact me, I can be reached 
via the Boston Computer Society, Amiga Bulletin Board (617) 729-7340, or by 
E-mail at hwollman at mitre.org


Contents of util/cli/heads.lha
 PERMSSN    UID  GID    PACKED    SIZE  RATIO     CRC       STAMP          NAME
---------- ----------- ------- ------- ------ ---------- ------------ -------------
[generic]                  131     158  82.9% -lh5- d50b Mar  1  1995 defhead.rexx
[generic]                  819    2273  36.0% -lh5- c8e2 Apr 15  1995 ends.rexx
[generic]                  244     312  78.2% -lh5- af5a Mar  1  1995 fhead
[generic]                   43      43 100.0% -lh0- 7e9c Mar  1  1995 fhead.f
[generic]                  637    1290  49.4% -lh5- e8e3 Apr 15  1995 head.rexx
[generic]                 1613    3463  46.6% -lh5- 7cab Nov  2  1995 heads.doc
[generic]                  760    1844  41.2% -lh5- d730 Apr 15  1995 tail.rexx
---------- ----------- ------- ------- ------ ---------- ------------ -------------
 Total         7 files    4247    9383  45.3%            Nov 17  1995

Aminet © 1992-2024 Urban Müller and the Aminet team. Aminet contact address: <aminetaminet net>