STScI Logo

tail system



tail -- print the last few lines of the specified files


tail files


A template specifying the files to be listed.
nlines = 12
The number of lines to be printed. If negative, the number of lines to be skipped, counting from the beginning of the file.


For each file in the input file list, tail copies the last nlines of the file to the standard output. If there is more than one file in the input file list, as one line header is printed before each file. If "nlines" is negative, then abs(nlines) lines are skipped, and the rest of the file is printed, i.e., the tail of the file is still printed, but the offset is measured from the beginning of the file rather than the end.


1. Prints the last 12 lines of each help file in the current directory.

cl> tail *.hlp

2. Print the last line of each help file.

cl> tail *.hlp nl=1

3. Prints the third through fifth lines of "file". The same thing might be done (at least conceptually) by "head file,nlines=5" piped into "tail ,nlines=3". However, tail does not work on STDIN.

	cl> tail file nl=-2 | head nl=3


Tail does not presently work on standard input, and therefore cannot be used in pipes.



Source Code · Search Form · STSDAS