Bash -- find a list of files with more than 3 lines
Solution 1:
You can use this find
command:
find . -type f -exec bash -c '[[ $(wc -l < "$1") -gt 2 ]] && echo "$1"' _ '{}' \;
Solution 2:
Using xargs
and awk
:
$ find . -type f | xargs wc -l | awk '$1 > 2'
If you are in a git repository and want to count only tracked files, you can use following command:
$ git ls-files | xargs wc -l | awk '$1 > 2'