Saturday, January 19, 2013

vim delete empty line (刪除空白行)


delete those lines which have no content :
:g/^$/d

delete those lines which are only composed of "space":
:g/^\s*$/d

delete those lines which are composed of "space or tab":
:g/^[ |\t]*$/d

刪除沒有內容的空行
:g/^$/d
刪除包含有空格組成的空行
:g/^\s*$/d
除以空格或tab開頭到結尾的空行
:g/^[ |\t]*$/d

From http://blog.cmchen.net/2006/12/25/325/

No comments:

Post a Comment