Dave's Brain

Browse - Programming Tips - How can I sort my source files by lines of code?

Date: 2016apr19
Language: bash
OS: Linux

Q.  How can I sort my source files by lines of code?

A.  This will do it:

wc -l *.java | sort -n wc -l *.cpp *.h | sort -n wc -l *.txt | sort -n
wc -l counts the lines sort -n sorts numerically

Add a comment

Sign in to add a comment
Copyright © 2008-2017, dave - Code samples on Dave's Brain is licensed under the Creative Commons Attribution 2.5 License. However other material, including English text has all rights reserved.