UTYPE
— Dump text files to standard output.
Syntax:
UTYPE
/A:
attribs /B /C /CP:
n /D /E /F:
string /H /HW:
n /K:
n /L:
format /N /P /Q /S /T /U:
string /X /Z:
n
filename…
/A: attribs | attributes mask; valid flags are -ACEHIORS |
/B | discard BEL characters (control-G, ASCII 7) |
/C | replace control characters with ^ sequences |
/CP: n | interpret non-Unicode input text using code page n |
/D | discard blank lines at the start of the file |
/E | discard all empty lines |
/F: string | show only lines following this string; /FF: inclusive |
/H | display the filename before each file |
/HH | display the filename, file size, and encoding before each file |
/HW: n | hex dump width, in bytes; only useful with /X |
/K: n | expand tabs to n columns |
/L: format | insert line numbers on the left |
/N | disable features |
/P | page output |
/Q | replace ASCII quotes and apostrophes with Unicode open and close quotes |
/S | search in subdirectories for matching files |
/T | trim leading and trailing whitespace |
/U: string | show only lines until (before) this string; /UU: inclusive |
/X | dump file in hexadecimal |
/Z: | handling of NUL characters in text: |
/Z:N — treat like end-of-line (default) | |
/Z:I — treat as invalid character | |
/Z:S — skip over (ignore) any NUL characters | |
… | Range options are also supported. |
UTYPE
displays files to standard output, much like the internal
TYPE
command. The primary advantage of UTYPE
is that
it recognizes and handles UTF-8 text files; you can think of it as a ‘UTF-8
TYPE’.
If you want to pipe to UTYPE
, 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, UTYPE
will read from
stdin before any filenames specified on the
command line. If no filenames are specified, then
UTYPE
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
display the contents of the clipboard.
If you include /L
on the command line,
UTYPE
will insert line numbers on the left, starting at 1, as
TYPE
does. If you include the optional format
string, UTYPE
will perform variable expansion on the string before
displaying it; use the variable _LINE
to get the current
(zero-based) line number. For example, /L:"%%@FORMAT[03,%%_LINE] "
will show the line number zero-padded to at least three digits.
/F:
and /U:
can be used to
chop off a simple header or footer. /F:
discards all lines up to
and including the first line which contains the specified
string (case-insensitive); /U:
discards all lines including and after a line which contains the specified
string (again, case-insensitive). For example,
most Project Gutenberg
ebooks include a header which ends in a line beginning with
“*** START” and a footer beginning with “*** END”. You
can strip them off like this:
utype "http://www.gutenberg.org/cache/epub/11/pg11.txt" /f:"*** start" /u:"*** end" /d | list
If you double the option letter — /FF:
or
/UU:
— the matching line will be included in
UTYPE
’s output, not discarded.
/E
discards all blank lines;
/D
discards only those at the start of a file. If you specify
both, /D
wins. If you combine /D
with
/F:
string, UTYPE
will
discard any blank lines following the header. A line containing only spaces or
tabs is considered blank.
/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 |
/NH | disable the handbrake |
/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
.
The handbrake:
When scrolling a long file to the console and /P
was not
specified, UTYPE
watches for the Ctrl and Esc
keys. Hold down the Ctrl key to slow the scrolling; press
Esc to pause the file as if /P
had been specified.
This feature will be disabled automatically if you specify /P
or
if output is redirected; you can also disable it with /NH
.
Quotes replacement:
/Q
causes UTYPE
to replace generic ASCII apostrophes
and quote marks ( ' and " ) with
Unicode open and close quote marks ( ‘ ’ and
“ ” ). The new
quote marks may or may not look different from the originals, depending on how
they are displayed and the font used. If the output is displayed in a
non-Unicode font, the curly quotes will be lost or mangled. You can set some
environment variables to control this feature.
utype "Engine Summer.txt"