How to count lines in a document?

后端 未结 24 1425
慢半拍i
慢半拍i 2020-11-27 08:47

I have lines like these, and I want to know how many lines I actually have...

09:16:39 AM  all    2.00    0.00    4.00    0.00    0.00    0.00    0.00    0.0         


        
24条回答
  •  渐次进展
    2020-11-27 09:32

    Use wc:

    wc -l 
    

    This will output the number of lines in :

    $ wc -l /dir/file.txt
    3272485 /dir/file.txt
    

    Or, to omit the from the result use wc -l < :

    $ wc -l < /dir/file.txt
    3272485
    

    You can also pipe data to wc as well:

    $ cat /dir/file.txt | wc -l
    3272485
    $ curl yahoo.com --silent | wc -l
    63
    

提交回复
热议问题