We follow cat(1) in defaulting to stdin if no arguments are specified and treating "-" as meaning stdin.
97 lines
2.1 KiB
Groff
97 lines
2.1 KiB
Groff
.Dd August 11, 2026
|
|
.Dt KATO 1
|
|
.Os
|
|
.Sh NAME
|
|
.Nm kato
|
|
.Nd view potentially malformed text files
|
|
.Sh SYNOPSIS
|
|
.Nm
|
|
.Op Fl hr
|
|
.Op Fl l Ar lines
|
|
.Op Ar
|
|
.Sh DESCRIPTION
|
|
.Nm
|
|
prints the contents of text files to the terminal.
|
|
Invalid UTF-8, control characters other than tab and newline, and
|
|
noncharacters are escaped in the output.
|
|
.Pp
|
|
If multiple files are specified (or the
|
|
.Fl h , Fl -header
|
|
option is given)
|
|
.Nm
|
|
prints a header showing the file name of each file before its contents.
|
|
.Nm
|
|
also prints a trailer after the file contents if the file was empty, did
|
|
not end with a newline, or (if the
|
|
.Fl l , Fl -lines
|
|
option is given) did not contain all the lines in the specified range.
|
|
.Pp
|
|
.Nm
|
|
expects the terminal to support UTF-8 and common ANSI SGR control codes.
|
|
.Pp
|
|
If no
|
|
.Ar file
|
|
is specified, or if
|
|
.Ar file
|
|
is
|
|
.Dq - ,
|
|
.Nm
|
|
reads from the standard input.
|
|
.Pp
|
|
The options are as follows:
|
|
.Bl -tag -width Ds
|
|
.It Fl h , Fl -header
|
|
Unconditionally print the header containing the file name.
|
|
.It Fl r , Fl -crlf
|
|
Allow CR + LF line endings.
|
|
By default
|
|
.Nm
|
|
will always escape a carriage return as
|
|
.Ql \er .
|
|
With this option, a carriage return just before a newline is ignored.
|
|
.It Fl l , Fl -lines Ar lines
|
|
Print only the specified
|
|
.Ar lines
|
|
from each file.
|
|
If followed by a single number,
|
|
.Nm
|
|
will print only that line.
|
|
To specify a range of lines, specify the starting line, followed
|
|
immediately by
|
|
.Sq - ,
|
|
followed immediately by the ending line, e.g.\&
|
|
.Ql 10-94 .
|
|
.El
|
|
.Sh EXIT STATUS
|
|
.Bl -tag -width Ds -compact
|
|
.It 0
|
|
Success
|
|
.It 1
|
|
Error while displaying the file or printing an error message
|
|
.It 64
|
|
Bad argument or option on the command line
|
|
.El
|
|
.Sh SEE ALSO
|
|
.Xr bat 1 ,
|
|
.Xr cat 1
|
|
.Sh STANDARDS
|
|
.Rs
|
|
.%D 2025
|
|
.%R RFC 9839
|
|
.%T Unicode Character Repertoire Subsets
|
|
.Re
|
|
.Nm
|
|
uses the
|
|
.Dq Unicode Assignables
|
|
subset, with the exception of carriage return (unless
|
|
.Fl r , Fl -crlf
|
|
is used).
|
|
.Sh AUTHORS
|
|
.An Juhani Krekelä Aq Mt juhani@krekelä.fi
|
|
.Sh BUGS
|
|
.Nm
|
|
reads the entire contents of the file into memory before outputting
|
|
anything to the terminal.
|
|
This is inefficient, and
|
|
.Nm
|
|
should instead stream the data.
|