Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove lines that is shorter than 5 characters before the @ using Notepad++

Maybe the title is 99% not understandable

I have like that:

abc@5004428
abcd@62604
abcde@505779

But my file is larger than that.

So, I want to remove the whole line that contain "abc" and "abcd" becase they are before @ and they are shorter than 5 or not equal characters.

More explained: I want to remove the whole line which value before @ is shorter than or EQUAL to 5 characters.

Any help would be appreciated.

Thanks!

like image 369
Mario Avatar asked Sep 01 '25 21:09

Mario


2 Answers

You can use regex like this: ^(.{0,4}@.*)$ to select lines and then remove them with Notepad++.

^ - a start of the line

.{0,5} - checks if value before @ is shorter than or equal to 5 characters.

NOTE: .{0,4} will check if value before @ is shorter than 5 characters (not equal to 5 characters).

.* - all other symbols after @.

$ - an end of the line

like image 166
Daria Pydorenko Avatar answered Sep 03 '25 20:09

Daria Pydorenko


Set 'Search Mode' to regular expression, and use the following phrase:

^\w{1,5}@.+

works like this:

^- : start of line

\w{1,5} : 1 to 5 word charachters long

@ : matches 'At sign' literally

.+ : remainder of line

and replace with empty line. To replace empty lines set search mode to extended and replace double line ends with single line ends.

like image 40
John Doe Avatar answered Sep 03 '25 22:09

John Doe