|
|
| Purpose: | Display the end of the specified file(s). |
| file | The file or list of files that you want to display |
| @file | A text file containing the name of a file to display in each line (see @file lists for details) |
/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 xxx | displays the last 5 lines of file xxx |
| tail /n+20 /n 999999 xxx | skip 20 lines, then display 999999 lines of xxx |
| tail /n+1001 /n 1 xxx | skip 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:
Select only those files that match the specified attribute(s).See Attribute Switches for details.
Display nn bytes, 512-byte blocks, kilobytes, or megabytes, when there is no suffix, for suffix b, suffix k, or suffix m, respectively.
| /F | Continuously monitor the file and display new lines until the command is interrupted, e.g, using Ctrl-C or Ctrl-Break.. |
Select files by a descriptor range. See the link for details.
| /N n | Display 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. |
Example: TAIL /N+5 file will display 10 lines (the default) after skipping 5 lines.
| /Q | Do 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. |