O caminho certo com o comando find
+ awk
:
find . -type f -size +0c -exec awk '{ exit (/^[[:space:]]/? 0 : 1) }' {} \; -print
A açãoThe
exit
statement causesawk
to immediately stop executing the current rule and to stop processing input; any remaining input is ignored. The exit statement is written as follows:exit [return code]
If an argument is supplied to exit, its value is used as the exit status code for the
awk
process
find
-print
será executada somente se awk
processar fornecer status de saída 0
Uma abordagem mais simplificada seria a seguinte:
find . -type f -size +0c -exec awk '{ exit (!NF? 0 : 1) }' {} \; -print