WC command of mac showing one less result

前端 未结 3 1505
萌比男神i
萌比男神i 2021-01-02 18:30

I have a text file which has over 60MB size. It has got entries in 5105043 lines, but when I am doing wc -l it is giving only 5105042 results which is one less than actual.

3条回答
  •  执念已碎
    2021-01-02 19:23

    60 MB seems a bit big file but for small size files. One option could be

    cat -n file.txt
    

    OR

    cat -n sample.txt | cut -f1 | tail -1
    

提交回复
热议问题