Use wc
:
(使用wc
:)
wc -l <filename>
This will output the number of lines in <filename>
:
(这将输出<filename>
的行数:)
$ wc -l /dir/file.txt
3272485 /dir/file.txt
Or, to omit the <filename>
from the result use wc -l < <filename>
:
(或者,要从结果中省略<filename>
,请使用wc -l < <filename>
:)
$ wc -l < /dir/file.txt
3272485
You can also pipe data to wc
as well:
(您也可以将数据传输到wc
:)
$ cat /dir/file.txt | wc -l
3272485
$ curl yahoo.com --silent | wc -l
63
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…