Skip to main content
Inspiring
August 29, 2026
Answered

how to remove blank lines

Hello,

In this example I would like to delete all the blank lines between the lines of text, or after the last line of text. How to do it ?

 

 

    Barb Binder
    Barb BinderCorrect answer
    Community Expert
    September 9, 2026

    Hi Pierre:

    I use

    Find: \s+$

    Change: [leave empty]

    Regular expressions on

    I prefer this because it picks up the pesky extra horizontal spaces at the end of the line, in addition to the extra ¶s.

     

    ~Barb at Rocky Mountain Training

    18 replies

    Barb Binder
    Community Expert
    Barb BinderCommunity ExpertCorrect answer
    Community Expert
    September 9, 2026

    Hi Pierre:

    I use

    Find: \s+$

    Change: [leave empty]

    Regular expressions on

    I prefer this because it picks up the pesky extra horizontal spaces at the end of the line, in addition to the extra ¶s.

     

    Translate
    ~Barb at Rocky Mountain Training
    Dave Creamer of IDEAS
    Community Expert
    Community Expert
    September 9, 2026

    Barb, does that work in Perl (the default) or just GREP? I change my settings to GREP since I know it better. 

    Translate
    David Creamer: Community Expert (ACI and ACE 1995-2023)
    Barb Binder
    Community Expert
    Community Expert
    September 9, 2026

    Hi Dave: 

    I use this string in InDesign (GREP tab enabled) and in FrameMaker (Regular Expressions enabled) exactly as I demo’d to remove trailing spaces. I don’t change anything for it to work in FrameMaker.

    Translate
    ~Barb at Rocky Mountain Training
    Community Expert
    September 7, 2026

    Hi,

    To really search for empty paragraphs enter this in the Find box: \P\p

    Replace with nothing. Leave the Change box empty.

    When you search for \p\p and replace with \p, this works as well. Did you really press Find and then Change. Or Change All?

    Best regards, Winfried

    Translate
    Inspiring
    September 7, 2026

    ​@Winfried Reng 

    Hi Winfried,

    What is working the best is with your solution :

    \P\p + nothing in change + “change all” button (one time)

     

    What is the difference between   \P\p   (on your solution) VS   \p\p   (on the Dave’s solution) ?

     

    Translate
    Community Expert
    September 7, 2026

    Explained in the online help in the Appendix, Keyboard shortcuts, Find and Change:

    \P Start of paragraph
    \p End-of-paragraph symbol
    This means:

    \P\p is an empty paragraph with nothing between the start and end of the paragraph symbols. However, note that FrameMaker does not count markers or anchors for tables or insets here. These could be accidentally deleted!

    \p\p means that there are two paragraph end symbols. In my tests this works as well.

    Translate
    Dave Creamer of IDEAS
    Community Expert
    Community Expert
    August 30, 2026

    The first paragraph return will need to be manually deleted. 

     

    Translate
    David Creamer: Community Expert (ACI and ACE 1995-2023)
    Inspiring
    August 30, 2026

    ​@Dave Creamer of IDEAS 

    Thank you Dave for the video. It helped me how to do.

    I understand that instead of using the “find” button, you use several times the “change all” button. So I have simply used several times the button “change all” and it worked (without doing anything else).

     

    Translate
    Dave Creamer of IDEAS
    Community Expert
    Community Expert
    August 29, 2026

    What exactly is happening? It looks like it selected to paragraph symbols. Did you continually press Change All?

    Translate
    David Creamer: Community Expert (ACI and ACE 1995-2023)
    Inspiring
    August 29, 2026

    ​@Dave Creamer of IDEAS 

    Here is a video showing the problem : it does not select the 2 paragraph symbols after each line of text.

    Translate
    Dave Creamer of IDEAS
    Community Expert
    Community Expert
    August 29, 2026

    You are not pressing the Change All button multiple times.

    Translate
    David Creamer: Community Expert (ACI and ACE 1995-2023)
    Dave Creamer of IDEAS
    Community Expert
    Community Expert
    August 29, 2026

    You can use a regular expression for find/change. 

    In GREP, it would be find: \r\r+

    Replace with: \r

    Note: the default in the find regular expression is Perl, not GREP, so it would need to be changed. 

     

    For an easier method, you can use the standard find option.

    Find: \p\p

    Change: \p

    Repeat change all until it can’t find anymore.

    Translate
    David Creamer: Community Expert (ACI and ACE 1995-2023)
    Inspiring
    August 29, 2026

    ​@Dave Creamer of IDEAS 

    Hi Dave,

    I have just tried to use your second solution (with \p\p), but it does not works. Why ?

     

     

    Translate