TAILNot in LE
Print Topic  Return to Overview  Previous Topic  Next Topic 
Purpose:Display the end of the specified file(s).

 

Format:TAIL [range ... [/I"text"]] [/A:[attrlist] /Cnn /F /N+x /N[ ]n /P /Q /V] {@file|file}...

 

fileThe file or list of files that you want to display
@fileA text file containing the name of a file to display in each line (see @file lists for details)

 

/A: (Attribute select)/N(umber of lines)
/C (number of bytes)/P(ause)
/F(ollow)/Q(uiet)
/I"text" (description range)/V(erbose)

/N+x (skip x lines before display)

 

See also: HEAD, LIST, and TYPE.

 

File Selection

 

Supports extended wildcards, ranges, multiple file names, and include lists.

 

Internet: Can be used with FTP servers, including HTTP/HTTPS files, e.g.

tail "http://jpsoft.com/notfound.htm"

 

Usage:

 

The TAIL command displays the last part of a file or files. It is normally only useful for displaying ASCII text files (i.e. alphanumeric characters arranged in lines separated by CR/LF). Executable files (.COM and .EXE) and many data files may be unreadable when displayed with TAIL because they include non-alphanumeric characters or unusual line separators.

 

You can press Ctrl-S to pause TAIL's display and then any key to continue.

 

The following example displays the last 15 lines of the files MEMO1 and MEMO2:

 

tail /n15 memo1 memo2

 

To display text from the clipboard use CLIP: as the file name. CLIP: will not return any data if the clipboard does not contain text. See Highlighting and Copying Text for additional information on CLIP:.

 

FTP Usage

 

TAIL can also display files on FTP servers.  For example:

 

tail "ftp://jpsoft.com/index"

 

You can also use the IFTP command to start an FTP session on a server, and then use an abbreviated syntax to specify the files and directories you want.

 

 

NTFS File Streams

 

TAIL supports file streams on NTFS drives. You can type an individual stream by specifying the stream name, for example:

 

tail streamfile:s1

 

Pipes

 

TAIL can optionally be used with an input pipe. For example:

 

dir | tail /n2

 

This is not ordinarily feasible in Windows because pipes can't be "rewound", and therefore the pipe has to be written to a temporary memory buffer and the TAIL taken from there. Consequently, this limits the amount you can actually display in TAIL to less than a million bytes when the input is piped.

 

Examples

 

tail /n 5 xxxdisplays the last 5 lines of file xxx
tail /n+20 /n 999999 xxxskip 20 lines, then display 999999 lines of xxx
tail /n+1001 /n 1 xxxskip 1001 lines, then display 1 line of xxx

 

set x=%@execstr[tail /n+1001 /n 1 xxx]sets x to the contents of the 1002-nd line of xxx
set x=%@execstr[tail /n 2 xxx]sets x to the contents of the penultimate line of xxx

 

Options:

 

/A:[attributelist]

       Select only those files that match the specified attribute(s).See Attribute Switches for details.

 

/Cnn[b|k|m]

       Display nn bytes, 512-byte blocks, kilobytes, or megabytes, when there is no suffix, for suffix b, suffix k, or suffix m, respectively.

 

/FContinuously monitor the file and display new lines until the command is interrupted, e.g, using Ctrl-C or Ctrl-Break..

 

/I"text"

       Select files by a  descriptor range. See the link for details.

 

/N nDisplay n lines. The default is 10. Space between the option switch /N and the number n is optional. If /N is specified without n, it is equivalent to specifying 0 lines to be displayed, and the command will not generate output, unless /V is also specified.

 

/N+xSkip x lines from the beginning of the file, than start displaying lines. If the /N+ option is specified without specifying x, the option is ignored. This option does not affect the number of lines displayed (unless the start line is too close to the end of file)

 

       Example:        TAIL /N+5 file        will display 10 lines (the default) after skipping 5 lines.

 

/PPause and prompt after displaying each page.

 

/QDo not display a header for each file. This is the default behavior, but an explicit /Q may be needed to override an alias that forces /V.

 

/VDisplay a header for each file.

 

Topic "tail.htm" last edited 5/12/2008. ©2008  JP Software, Inc.
Keywords: TAIL,HEAD,TYPE