9

I have this folder contiaining a lot of *.cpp and *.h files. I want to get a line count of all the files and display them to the screen in sorted order of line count.

I know wc -l *.h *.cpp will display all the file names with line count, but not in sorted order.

smilingbuddha
  • 14,334
  • 33
  • 112
  • 189

1 Answers1

19

Use wc -l *.h *.cpp | sort -n. One job (sort), one tool (sort).

thiton
  • 35,651
  • 4
  • 70
  • 100