User Tools

Site Tools


Remove Mutli-Blank lines

When we coding and can found there has some blank lines, so we need to remove them but just keep one blank line.

So here has some solutions

  • cat -s
  • sed 'N;/^\n$/D;P;D;'
  • for i in *; do FILE=$(cat -s “$i”); echo “$FILE” > “$i”; done


/var/www/dokuwiki/wiki/data/pages/linux/remove-multi-blank-lines.txt · Last modified: 2017/12/20 10:34 by percy