perl -an0777 -F"\n\n" -e 'END { print "There are ", scalar @F, " records in $ARGV\n" }' foo.txt