Files

55 lines
1015 B
Groff

.TH length "" "" "/rdb Command"
.PC "Return the length of its argument or input file"
\fBlength [\fIstring\fB] [< \fIfile\fB]\fR
.PP
.II "length of string"
.II "string^length"
The command
.B length
outputs the number of characters in its first argument.
If there
is no argument, it reads the standard input.
.PP
Because
.B length
counts only its first argument, you must put quotation marks
around all of the words on the command line to make them one argument.
.PP
.II wc
.B length
uses
.B "wc -c"
to do the counting.
.SH Example
Here we find the length of a string and a file.
.DM
length aA1
.DE
.PP
This returns \fB3\fR.
.PP
The next command
.DM
length 'word1 word2'
.DE
.PP
returns \fB11\fR \(em that is, the length of
.B word1
plus
.B word2
plus the space between them.
.PP
The final example measures the number of characters in file
.BR length.1 :
.DM
length < length.1
.DE
.PP
Note that you need must quote strings if they have spaces or tabs in them.
.SH "See Also"
COHERENT Lexicon:
.B
wc
.R
.SO length