How to mark all lines in a file containing pattern "aabbcc"?
pstein last edited by
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?
jonandr last edited by
Open find and replace dialog, check “Regular expressions”. Replace:
ptoniolo last edited by
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.
David Bailey last edited by
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.
guy038 last edited by guy038
The remark of ptonolio about the End of Line characters is quite judicious ! But we can avoid the
\r?\nsyntax, using the syntax
\R?. This syntax matches ANY optional end of line (
\r\nin Windows files,
\nin Unix/OSX files and
\rin 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 :
REPLACE : Nothing
and click on the Replace All button
rishabh pant last edited by
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.