Issue
I have a directory of files and I want to find a list of files who has more than 2 lines.
I know I can use wc -l to test each file, but how do I wrap it up in bash?
Sorry for the newbie question, new to bash.
Solution
You can use this find
command:
find . -type f -exec bash -c '[[ $(wc -l < "$1") -gt 2 ]] && echo "$1"' _ '{}' \;
Answered By - anubhava Answer Checked By - Gilberto Lyons (WPSolving Admin)