sorting files based on non empty lines linux

Find py files, count non-empty lines with grep, revert columns with awk, and sort in inverse numeric order:

find -name '*.py' -exec grep -v '^$' -c {} -H \; | \
    awk -F: '{print $2, $1}' | \
    sort -nr

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top