UPEND — Display lines from a file in reverse order.

Syntax:
UPEND /A:attribs /B /C /CP:n /E /H /L:string /N /P /R:string /S /T /V /W:n filename…

/A:attribsattributes mask; valid flags are -ACEHIORS
/Bdiscard blank lines
/Creplace control characters with ^ sequences
/CP:ninterpret non-Unicode input text using code page n
/Eexpand variables in the /L: and /R: strings
/Hdisplay the filename before each file
/L:stringinsert string to the left of each line
/Ndisable features
/Ppage output
/R:stringinsert string to the right of each line
/Ssearch in subdirectories for matching files
/Ttrim leading and trailing whitespace
/Valso reverse each line in the file
/W:ntruncate lines to n characters
Range options are also supported.

UPEND is a low-budget substitute for the Unix tac command. It can read from disk files or from a pipe. If you want to pipe to UPEND, remember that pipes open a new shell. To pipe to a plugin command, you must either ensure that the plugin is loaded in the transient shell, e.g. by installing the .DLL file in the shell’s PlugIns directory; or else use temporary files or an in-process pipe.

If standard input (stdin) is redirected, UPEND will read from stdin before any filenames specified on the command line. If no filenames are specified, then UPEND will read from stdin whether it is redirected or not. Filenames may include wildcards and directory aliases. You can search into subdirectories for matching files with /S. @File lists and internet files are supported. You may also specify CLIP: to read lines from the clipboard.

If /L: is specified, the given string will be inserted to the left of each line; /R: inserts a string to the right. If /E is also specified, variable expansion will be performed on each string. Along with TCC’s usual complement of internal variables, functions, and so on, UPEND will set an environment variable _LINE. _LINE will contain the value 0 for the first line listed (i.e. the last line in the file), 1 for the second line listed, and so on. You can massage this value with functions like @INC, @EVAL, @FORMAT, and so on. To prevent the variables from being expanded before UPEND executes, you must either enclose the string in backquotes or double the percent signs.

/N disables features:

/NBdo not write a Byte Order Mark
/NCdisable highlight
/NDdo not search into hidden directories; only useful with /S
/NFsuppress the file-not-found error
/NJdo not search into junctions; only useful with /S
/NZdo not search into system directories; only useful with /S

You can combine these, e.g. /NDJ.


upend D:\download\pg11.txt /l:"%%@format[4,%%_line] " /e