help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to grep for a string spanning multiple lines?


From: tomas
Subject: Re: How to grep for a string spanning multiple lines?
Date: Sat, 26 Nov 2022 09:36:06 +0100

On Sat, Nov 26, 2022 at 07:42:59AM +0100, Marcin Borkowski wrote:
> Hi all,
> 
> assume I have a file (probably an Org mode one) with some stuff
> I archived from the 'net.  (I'm going to start to sue
> youtube-sub-extractor.el.)  Here is my problem: assume I remember that
> someone in some video said something, and I want to find that part.
> However, it turns out that it is split between two (or more) lines.
> 
> Traditional `grep' is not helpful in this situation.  Neither is
> isearch, nor swiper.  One idea would be to convert the subtitles to one
> long line (which is an option), but are there any other ways to search
> for a string spanning more than one line (and not knowing which words
> are separated by a space and which ones by a newline)?
> 
> Both Emacs-y and shell-y tools would be appreciated.

Note that, at least, in Emacs, the POSIX character class [:space:]
also matches line breaks. So if you always use [[:space:]]+ to
separate your words, you might find what you are looking for.

Cheers
-- 
t

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]