Wednesday, 15 August 2012

replace - Notepad++ or UltraEdit: regex remove special duplicates -



replace - Notepad++ or UltraEdit: regex remove special duplicates -

i need remove duplicates if

key =

but not

key=anything

the key can too

e.g. edit_home=home must in place

while edit_home = home or other string must removed if edit_home duplicate

for lines of document

thank you

p.s. clearer example:

one=you two=we three_why=8908908 1 = 2 = fine three_4 = best three_why = win

from list need keep:

one=you two=we three_why=8908908 three_4 = best // because three_4 doesn't have duplicate

i found method it, need improve search list back upwards regex or plugin or direct regex (which don't know).

that is: have 2 files compare.

one has total keys, other has incomplete.

i merge in new file keys first file ones of second, in groups (because keys in groups e.g. many keys titled one, many titled 2 , on...). regex replace keys in new file by

find (.*)(\s\=\s) replace \1\=

so become key=anything

then replace after = empty isolate keys.

then remove duplicates.

at point have problem like

^.*(^keyone\b|^keytwo\b|^keythree\b).*$

to find keys in document need. can select , replace right keys.

why? because in illustration keys 3 indeed keys many , find field breaks @ point.

how right?

update: found toolbucket plugin allows search many strings, issue in add-on duplicate, have remove original.

that is, if find 2 times same key "one" have remove lines containing one.

ctrl + f

find tab

find what: ^.*\s=\s.*$

find in current document

copy result result window new window (the list of line 1: line 2: line 3: ...)

ctrl + f

replace tab

(the next remove leading "line number:" every line)

find what: ^.*?\d:\s

replace with: empty

regex replace notepad++ duplicate-removal ultraedit

No comments:

Post a Comment