Skip to main content
Grant H
Community Expert
Community Expert
January 22, 2020
Answered

GREP: removing lines of (nothing) after data merge

Hi guys. GREP (sigh)...
I need to remove the empty lines after datamerge for certain products. The checkbox to delete blank lines will not work in this case. I have tried to get the grep correct but to no avail, please can someone help. In my eg i need the "Black" to move up.

thanks

/G

 

This topic is closed to new replies. Start a new post to keep the conversation going.
Grant H
Grant HCorrect answer
Community Expert
January 22, 2020

okay...   it seems that:

 \s+$

works.

Thanks

 

10 replies

Community Expert
January 22, 2020

Hi Grant,

I suggest you'd make a sample text frame available for testing.

Could be even a IDMS file with Dropbox or a similar service.

 

Thanks,
Uwe Laubender

( ACP )

Translate
Grant H
Community Expert
Grant HCommunity ExpertAuthor
Community Expert
January 23, 2020

Hi Laubender,

the grep i "stumbled" (cause i suck at it) seems to work perfectly for what I am doing so all good for now.

 

thank you

Translate
Grant H
Community Expert
Grant HCommunity ExpertAuthorCorrect answer
Community Expert
January 22, 2020

okay...   it seems that:

 \s+$

works.

Thanks

 

Translate
Community Expert
January 22, 2020

Sorry, I thought you just wanted to remove paragraphs that had nothing. However your grep expression will not work in some cases like

  • if the text has something like abc tab tab paragraph your expression will match it which should not be the case as the paragraph does have content abc

I would suggest you to use the following expression

^\s*\r

This will start from the start of the paragraph, make sure either the paragraph is empty or has one or more whitespace characters only and then it is followed by the paragraph end character

 

-Manan

Translate
-Manan
Grant H
Community Expert
Grant HCommunity ExpertAuthor
Community Expert
January 22, 2020

Hi Manan, the problem with that is it assumes the paragraph style from the text above the blank lines. also the \s+$ grep doesnt match the eg you mentioned:

as can be seen here after running the \s+$ grep. Even if there is abc tab tab paragraph.

 

 

 

Translate
Community Expert
January 22, 2020

Hi Grant,

 

In Find Grep, use find what as following

^\r

and leave the change to as blank, this should hopefully work if i understood your requirement properly

 

-Manan

Translate
-Manan
Grant H
Community Expert
Grant HCommunity ExpertAuthor
Community Expert
January 22, 2020

Hi Manan, no that wont work it still would leave the paragraphs that have a tab for instance.

Translate