OS4 DepotLogo by Kicko 
(anonymous IP:,2216) 

   Bug tracker
   Locale browser


   o Audio (343)
   o Datatype (51)
   o Demo (203)
   o Development (600)
   o Document (22)
   o Driver (97)
   o Emulation (148)
   o Game (1005)
   o Graphics (499)
   o Library (116)
   o Network (233)
   o Office (66)
   o Utility (927)
   o Video (69)

Total files: 4379

Full index file
Recent index file



Support the site

 Readme for:  Utility » Shell » headtail.lha


Description: Show first/last n lines/chars/blocks of a file
Download: headtail.lha       (TIPS: Use the right click menu if your browser takes you back here all the time)
Size: 45kb
Version: 1.3
Date: 23 Nov 2005
Author: D. Champion, Dan Cannon, Alex Carmona
Submitter: Alex Carmona
Email: AmigaOne/theworld net
Homepage: http://AM1GA.com
Category: utility/shell
License: Public domain
Distribute: yes
Min OS Version: 4.0
FileID: 1328
Comments: 0
Snapshots: 0
Videos: 0
Downloads: 348  (Current version)
381  (Accumulated)
Votes: 0 (0/0)  (30 days/7 days)

Show comments Show snapshots Show videos Show content Show crashlogs Replace file 
HeadTail is a dual purpose command that acts as Head or Tail depending on its
own filename. If the command name ends with tail it will act as Tail,
otherwise it will default to Head.
It can be used to split or extract portions of binary files too, but in that
case the output should be piped or redirected to a file and the [l]ine option
should not be used.

Quick installation:
Either copy HeadTail to C:Head and again as C:Tail or make a link from C:Head
to C:Tail if disk space is limited.
The newlib version is smaller and works the same way but requires
newlib.library version 1.6 or greater in Libs:

Smaller newlib version included. Requires newlib.library v1.6+

This is a quick port to Amiga OS4. While I was at it I also fixed a few bugs
and added a help section for the command line.

----- v1.1 Read Me -----

This is an update to headtail.lha, written by D. Chapman. It was going wrong
sometimes, I changed it to work with longer lines. While I was at it, I made
it so that the file name can be case insensitive (eg. you can call it head,
Head, tail, TAIL, etc...) because it checks its own file name to work out
whether you want head or tail.

Anyway, copy HeadTail to C:Head and C:Tail and you're sorted.


----- Original Read Me -----

Short: unix-style head/tail, better than others

Well, yes, they are, to be honest.  I haven't yet seen a "head" or
"tail" program for AmigaDOS which even implemented the lbc stuff in
the "real" tail for Unix.  Though numerous, all the tails I've seen
can only do lines, with one exception that could do chars.  This last,
however, couldn't read from standard input.  I found my work severely
limited; I maintain that head and tail are among the most useful tools
in the unix environment.

So here's a tail program that reads any number of files, or standard
input; if more than one file is read, the start of each file is noted
in stderr, with files sections themselves going to stdout.  Unlike
most other Amiga tails I've seen, headtail can do head-relative or
tail-relative tailing by using "+" or "-" before the count.  E.g., for
the file:



> tail +3l <file>

would report:



> tail -3l <file>

would report:


You see?

Character units (specifiec with "c" in place of "l") work similarly;

> tail -7 <file>

on the above example file would return:

(You must remember to count line feeds.)

Blocks work the same way; a block is equivalent to 512 characters.
You can change this in the source code to 488 if you use an OFS
system; it will more accurately reflect your actual file structure.


The Unix "head" is included, too.  Soaring above even Unix head,
however, headtail's head will take all the same arguments as tail.
The only difference in meaning is that "+" and "-" swap places; i.e,

Program Sign Meaning
tail + count is relative to start of file
tail - count is relative to end of file
head + count is relative to end of file
head - count is relative to start of file

Thus Unix-formatted commands work with headtail, but there are more
option if you want them.


As a special for Kickstart v36+ users, head and tail are included as
one program.  It works like compress: there's one program, and its
function is determined by its name.  Basic installation consists of
copying tail to somewhere in your path, and making a link from "head"
to "tail".  (You could, of course, do it the other way.)  If called as
"head", the program performs head stuff; if called as "tail", it does
tail stuff.  If called something else, it still does tail stuff.

If you don't have 2.0, you should.  But you can still use headtail by
just copying the program to "head", then to "tail".  They don't have
to be links, but it saves disk space if they are.

HeadTail was written by David Champion some time in July - August
1992.  It was compiled with Matt Dillon's DICE, and the source code is
geared toward that compiler.  SAS users will have to perform surgery
to make it work, I know.  I tried and gave up becasue I hate SAS
anyway.  Aztec users might have to do cosmetic stuff.  GCC works fine;
just be sure you've either #defined of -D-defined GCC.

This stuff, binary and source, is public domain.  I release all
liability for damages brought about by usage at just the wrong time of
day in La Paz, or whatever else could cause a problem, along with
rights to the code.  It's everyone's now.

Copyright © 2004-2024 by Björn Hagström All Rights Reserved