How do I show the number of lines in a file in Unix?

How do I show the number of lines in a file in Unix?
Answer
How to Count lines in a file in UNIX/Linux
  1. The “wc -l” command when run on this file, outputs the line count along with the filename. $ wc -l file01.txt 5 file01.txt.
  2. To omit the filename from the result, use: $ wc -l < file01.txt 5.
  3. You can always provide the command output to the wc command using pipe. For example:
 

Tìm kiếm

Back
Top