How to count lines in a document?

后端 未结 24 1430
慢半拍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:16

    If all you want is the number of lines (and not the number of lines and the stupid file name coming back):

    wc -l < /filepath/filename.ext
    

    As previously mentioned these also work (but are inferior for other reasons):

    awk 'END{print NR}' file       # not on all unixes
    sed -n '$=' file               # (GNU sed) also not on all unixes
    grep -c ".*" file              # overkill and probably also slower
    

提交回复
热议问题