显示特定文件的行数

Tes*_*t3r 5 linux grep command-line cat

这是显示特定文件行数的正确方法吗?

cat file | grep * -c
Run Code Online (Sandbox Code Playgroud)

Gaf*_*aff 16

你可以使用这个命令:

wc -l <file>

这将返回提供的文件中的总行数计数。