 <p>This should do the trick:</p> <pre><code>#!/bin/bash for file in `find $1 -type f -name "*.txt"`; do nlines=`tail -n 1 $file | grep '^$' | wc -l` if [ $nlines -eq 1 ] then echo $file fi done; </code></pre> <p>Call it this way: <code>./script dir</code></p> <p>E.g. <code>./script /home/user/Documents/</code> -> lists all text files in <code>/home/user/Documents</code> ending with <code>\n</code>.</p>