linux - How to only get the number of lines of a file -


how number of lines of file in linux?

i want number of lines, not filename.
want in single command, without grep or utility.

wc -l sample.txt    

output

5 sample.txt 

desired output

5 

try this

wc -l < sample.txt 

wc doesn't print out filename if reads file through standard input. < feeds file via standard input.


Comments

Popular posts from this blog

assembly - 8086 TASM: Illegal Indexing Mode -

Java, LWJGL, OpenGL 1.1, decoding BufferedImage to Bytebuffer and binding to OpenGL across classes -

asp.net - Configuring WCF Services in Code WCF 4.5 -