How can I remove empty /blank lines in every txt file of a directory (ideally subdirectories too)?
find . -name '*.txt' -exec ex '+%s/\ / /g' -cwq {} \;
Above code is pulling list of files correctly but i am not sure what regular expression to pass to remove blank lines.
With GNU find and GNU sed:
find . -name '*.txt' -exec sed -ri '/^\s*$/d' {} \;