0

Windows 10, Emacs 25.1 Suppose I has the next text

111111111111111111

hello

22222222

aaaahello

3333333333333333333333333333333

aabbbbbbbbhellocccccdddddddd

aaaaaaaaaaaaaaa

cccccccccccccccc

dddddddd

rhellorraaaa111111111

I want to delete all rows that contain text hello. How I can do this? Thanks.

1 Answer 1

5

You can use the command delete-matching-lines via

M-x delete-matching-lines RET hello RET.

Note that tab-expansion helps a lot with typing command names at the minibuffer. You just need to type

M-x dele TAB ma TABRET hello RET.

5
  • I use helm mode. It's show all commands. It's very helpful. Thanks. Command "delete-matching-lines" work fine. Jul 11, 2018 at 8:37
  • 2
    In case anybody is wondering, delete-matching-lines is an alias for flush-lines. I came here to recommend that solution and then discovered that they are the same.
    – MTS
    Jul 11, 2018 at 17:01
  • Is there an analog for cutting?
    – user19777
    Sep 23, 2022 at 5:29
  • 1
    @Erwann Does kill-matching-lines what you mean by "cutting"? There is also copy-matching-lines if needed.
    – Tobias
    Sep 23, 2022 at 7:32
  • @Erwann "Cut" and "Paste" in other applications are very close to "Kill" and "Yank" in Emacs.
    – Tobias
    Sep 23, 2022 at 8:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.