0

Emacs 26.1, Windows 10

If I want to show all lines content text in one line I use command occur

M-x occur text_to_find

Nice. It's work fine.

But how I can use occurif text to find is on 2 lines?

E.g.:

aaa bb cccc
test this text_to_find hello how I your?
result is very good
ddd eee ffff

enter image description here

So I need to show all lines content the next text (in 2 lines)

text_to_find

result

a_subscriber
  • 4,062
  • 1
  • 18
  • 56

1 Answers1

4

You have to use a literal C-j to match the newline, which you can etnter by prefixing it with C-q, i.e.

M-x occur RET text-to-find.*C-qC-j.*result

(occur also takes a prefix argument that tells it how many lines of context to show, which can be useful too).

rpluim
  • 5,245
  • 11
  • 25
  • "occur also takes a prefix argument that tells it how many lines of context to show, which can be useful too" - it's very cool. Thanks – a_subscriber Feb 08 '19 at 13:29