Skip navigation

To remove empty lines in a region simply do:

M-x flush-lines RET ^$ RET 

or, if blank lines contain some white spaces characters:

M-x flush-lines RET ^\W*$ RET 

Whereas with sed (which I use inside emacs via M-| shell-command-on-region ) it’s simply:

sed -e '/^[	 ]*$/d' 
(this is either a tab or a space, press the TAB key since most versions 
of sed don't recognize the \t character) 

How easy is to forget this type of things!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: