Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Ok, so if you search for "word delete blank lines" you get a lot of stuff but they are mostly talking about the special characters to replace two successive empty paragraphs, i.e. replace ^p^p with ^p. And before you ask: no, it doesn't work to replace ^p with an empty replacement, because ^p matches a carriage return and not a paragraph (i.e. it will replace all carriage returns in a document, transforming it into one long text).

However, I do have empty lines which are just lines with no text in front of a carriage return: in terms of regular expression I would describe this as

^$

Or in terms of HTML, I'm talking about this:

<p>Some text</p>
<p></p>
<p>some more text</p>

And in vi I would simply delete blank lines. But I cannot export the word, modify text and import, it's using heavy formatting, etc.

Using Microsoft Word 2007.

share|improve this question
1  
Shouldn't replacing ^p^p with ^p work, seeing as a single blank line appears as some text^p^pmoretext? – jmetz Jul 31 '12 at 17:10
up vote 4 down vote accepted

@mutzmatron is right, replacing ^p^p with ^p actually is the proper way.

However, when my documents contains e.g. ^p^p^p^p or similar, it won't pick them all up and will again leave ^p^p. So I've to run this search/replace operation a few times until all cases have been covered.

share|improve this answer
1  
If you have many sequences of many blank lines (paragraphs), consider replacing ^p^p^p^p with ^p until it doesn’t find any more ^p^p^p^p’s, then do the ^p^p -> ^p thing. – Scott Nov 15 '12 at 23:42
    
@mark This does not seem to work if there are two consecutive paragraphs (^ps) of different styles, whether it be a difference in paragraph style or character style. – macmadness86 Dec 17 '13 at 10:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .