Skip to main content
Participant
April 3, 2024
Answered

grep for sentences

  • April 3, 2024
  • 1 reply
  • 383 views

I have figure captions in a big document that have two sentences (with periods after them, of course). After I run the List of Figures, I want to remove the second sentence. There are no other periods in each "paragraph," and the second sentence is followed by a tab. I need help to write the grep so it will find all words between two periods (including the second period) so I can delete that second sentence automatically, please. I've tried all sorts of combinations and I can't get it to work.

This topic has been closed for replies.
Correct answer Eugene Tyson

And if you need to keep the tab change the last part to (?=\t)

1 reply

Barb Binder
Community Expert
Community Expert
April 4, 2024

Unclear what you mean by "run the list of figures" and screen shots always help us help you faster because it removes the guesswork, but taking a stab. 

 

I'm highlighting what I think you are asking for... did I get it right? if you don't need to match the tab, remove the final 

\t. And if by "paragraph" you want them to be paragraphs but they are all one big paragraph, you can replace the tabs with returns and then this should work. 

 

If yes, Find:

\.\K.+\.\t

 

 

~Barb

 

 

 

 

~Barb at Rocky Mountain Training
AdLiBAuthor
Participant
April 4, 2024

Oh YAY!!! It works like a charm! I can't thank you enough!!! I keep having to run new TOC for Figures in this large file because every time it is "final," it isn't! Right now I don't have time to study up on the GREP stuff, but I will. So thank you for getting me over this hump!

Eugene TysonCommunity ExpertCorrect answer
Community Expert
April 4, 2024

And if you need to keep the tab change the last part to (?=\t)