How do I count the number of lines in a file?

Tiên Hương

New member
How do I count the number of lines in a file?
Answer
Approach:
  1. Create a variable to store the file path.
  2. Use wc –lines command to count the number of lines.
  3. Use wc –word command to count the number of words.
  4. Print the both number of lines and the number of words using the echo command.
 

Tìm kiếm

Back
Top