How to mark all lines in a file containing pattern "aabbcc"?

  • Assume I have a very large (huge) text file with 100000 lines, Think of a log file.

    I want to delete now all of the lines which contain a certain pattern simplified e.g. “aabbcc”.

    How can I achieve this?

    I miss a function/menu “display (only) all lines containing pattern”.
    Then I could mark+delete them.

    Can this option be added in the next release?


  • Open find and replace dialog, check “Regular expressions”. Replace:


    with nothing.

  • Mark the lines with the Find mask, then on the menu: Search/Bookmark/Remove Bookmarked Lines.

    @jonandr: be careful that the line ending could be a single linefeed: it’s better to put a question mark after the carriage return.

  • I don’t know exactly what aabbcc is meant to stand for - does ‘a’ stand for one character?

    Anyway, you could do the search with a regular expression. Then you could create a macro out of a search followed by a line delete. After that, you could use the repeat macro button, and put in a large number.

    Remember that macros can be saved and then executed like other commands.


  • Hello Pstein,

    The remark of ptonolio about the End of Line characters is quite judicious ! But we can avoid the \r?\n syntax, using the syntax \R?. This syntax matches ANY optional end of line ( \r\n in Windows files, \n in Unix/OSX files and \r in Old Mac files )

    In addition, I would add the modifier (?-s), at the beginning of the search regex ( meaning NOT a SINGLE line ), just in case, you checked, by mistake, the . matches new line option, in the Replace dialog.

    To end, if you mind about the case, I would add the modifier (?-i) ( meaning NO IGNORE case ), just in case you forgot to check the Match case option

    So, according that you would like to delete any line, containing, exactly, the literal string aabbcc, choose the regular expression search mode, with :

    SEARCH : (?-is).*aabbcc.*\R?

    REPLACE : Nothing

    and click on the Replace All button



  • Being in healthcare Services industry I have to work on manipulating Middleware data.
    One of the things that I found best about Notepad++ is multiple text editing options.

    To mark lines having same pattern:

    • Copy pattern and type Ctrl + f.

    • list item In Mark tab paste the pattern you are looking for in document.

    • list item Tick Bookmark Line button and click on Mark All.

    • list item Once all lines with pattern are marked you can delete them by

    • list item Go to Search --> Bookmarks --> Remove Bookmarked Lines.

    Refer this site for more descriptive and pictorial expalainations.

Log in to reply