all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* delete whitespace lines with replace-regexp
@ 2007-07-12  6:53 oliver
  2007-07-12 12:49 ` weber
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: oliver @ 2007-07-12  6:53 UTC (permalink / raw)
  To: help-gnu-emacs

hello

i want to use query-replace-regexp or replace-regexp to delete all lines 
contain only whitespace.

so i tried the the command with the search regexp "^\s-*$^J" (with ^J as in 
ctrl-q ctrl-j) and an empty replacement. nothing gets replaced.

what's wrong?

thanks, olli

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: delete whitespace lines with replace-regexp
  2007-07-12  6:53 delete whitespace lines with replace-regexp oliver
@ 2007-07-12 12:49 ` weber
  2007-07-12 15:08 ` Peter Dyballa
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: weber @ 2007-07-12 12:49 UTC (permalink / raw)
  To: help-gnu-emacs

On 12 jul, 03:53, "oliver" <oliver_baum...@nospam.justemail.net>
wrote:
> hello
>
> i want to use query-replace-regexp or replace-regexp to delete all lines
> contain only whitespace.
>
> so i tried the the command with the search regexp "^\s-*$^J" (with ^J as in
> ctrl-q ctrl-j) and an empty replacement. nothing gets replaced.
>
> what's wrong?
>
> thanks, olli

Well, it looks like you can't use '$' unless on the end of the regexp.
Anyway I tried with ^\s-*^J and it does what you want!
Sorry for the incomplete answer,
-weber

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: delete whitespace lines with replace-regexp
  2007-07-12  6:53 delete whitespace lines with replace-regexp oliver
  2007-07-12 12:49 ` weber
@ 2007-07-12 15:08 ` Peter Dyballa
  2007-07-12 17:25 ` Eric Hanchrow
       [not found] ` <mailman.3395.1184252932.32220.help-gnu-emacs@gnu.org>
  3 siblings, 0 replies; 5+ messages in thread
From: Peter Dyballa @ 2007-07-12 15:08 UTC (permalink / raw)
  To: Emacs Mailing List


Am 12.07.2007 um 08:53 schrieb oliver:

> what's wrong?

The $ is too much. I'd make it, old-fashioned, this way

	M-x query-replace-regexp RET ^ [ SPC C-q TAB ] + C-q C-j RET RET

i.e.: change all lines starting with SPC or TAB and having only SPC  
or TAB until the final linefeed with nothing.

--
Mit friedvollen Grüßen

   Pete

Stau ist nur hinten blöd, vorne geht's!

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: delete whitespace lines with replace-regexp
  2007-07-12  6:53 delete whitespace lines with replace-regexp oliver
  2007-07-12 12:49 ` weber
  2007-07-12 15:08 ` Peter Dyballa
@ 2007-07-12 17:25 ` Eric Hanchrow
       [not found] ` <mailman.3395.1184252932.32220.help-gnu-emacs@gnu.org>
  3 siblings, 0 replies; 5+ messages in thread
From: Eric Hanchrow @ 2007-07-12 17:25 UTC (permalink / raw)
  To: help-gnu-emacs

I know you said that you wanted to use replace-regexp, but if you're
willing to be flexible -- I'd just to

        M-x flush-lines RET ^ \s-*$ RET
-- 
Most of what ends up in my essays I only thought of when I sat
down to write them.  That's why I write them.
        -- Paul Graham

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: delete whitespace lines with replace-regexp
       [not found] ` <mailman.3395.1184252932.32220.help-gnu-emacs@gnu.org>
@ 2007-07-12 23:22   ` oliver
  0 siblings, 0 replies; 5+ messages in thread
From: oliver @ 2007-07-12 23:22 UTC (permalink / raw)
  To: help-gnu-emacs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 518 bytes --]

thanks heaps, guys!

olli


"Peter Dyballa" <Peter_Dyballa@Web.DE> wrote in message 
news:mailman.3395.1184252932.32220.help-gnu-emacs@gnu.org...

Am 12.07.2007 um 08:53 schrieb oliver:

> what's wrong?

The $ is too much. I'd make it, old-fashioned, this way

M-x query-replace-regexp RET ^ [ SPC C-q TAB ] + C-q C-j RET RET

i.e.: change all lines starting with SPC or TAB and having only SPC
or TAB until the final linefeed with nothing.

--
Mit friedvollen Grüßen

   Pete

Stau ist nur hinten blöd, vorne geht's!

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2007-07-12 23:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-12  6:53 delete whitespace lines with replace-regexp oliver
2007-07-12 12:49 ` weber
2007-07-12 15:08 ` Peter Dyballa
2007-07-12 17:25 ` Eric Hanchrow
     [not found] ` <mailman.3395.1184252932.32220.help-gnu-emacs@gnu.org>
2007-07-12 23:22   ` oliver

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.