perl -0 -p -e 's/\n\s*\n/EEEEE/g' textfile