published: 25th of July 2020
This is just a quick post to outline how to remove the lines with only white space from all files in a directory tree. I found another method to do this with the application I am using but I wanted to keep this handy one liner in my back pocket for future reference.
The incantation goes like this.
find _site/ -type f -name '*.html' -print0 | xargs -0 sed -i '/^[[:space:]]*$/d' $1;
This command will alter the files in place without creating a backup. Use at your own risk.
In this post we covered how to remove the white space from all files in a directory tree using find and sed