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: attribs | attributes mask; valid flags are -ACEHIORS |
/B | discard blank lines |
/C | replace control characters with ^ sequences |
/CP: n | interpret non-Unicode input text using code page n |
/E | expand variables in the /L: and /R: strings |
/H | display the filename before each file |
/L: string | insert string to the left of each line |
/N | disable features |
/P | page output |
/R: string | insert string to the right of each line |
/S | search in subdirectories for matching files |
/T | trim leading and trailing whitespace |
/V | also reverse each line in the file |
/W: n | truncate 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.
/NB | do not write a Byte Order Mark |
/NC | disable highlight |
/ND | do not search into hidden directories; only useful with /S |
/NF | suppress the file-not-found error |
/NJ | do not search into junctions; only useful with /S |
/NZ | do 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