Friday 15 May 2015

notepad++ - Removing Rows based on duplicate keywords using Regex -



notepad++ - Removing Rows based on duplicate keywords using Regex -

i looking find reply on how remove row has duplicate keyword or ip address. example.

169.146.25.111 1412969662.95 create unique 169.146.25.111 1412969662.95 info doesn't matter 169.146.25.111 1712515362.95 different 169.146.25.112 1412969662.95 don't care what's here 169.146.25.111 1315125152.95 erroneous info

so want match ip address, , search next lines, if finds ip address @ origin of line, remove row. i've been trying use.

find what: ^(\s+)(.*?)$\s+(?=.*^\1).*?$ replace with: \1\2

desired result

169.146.25.111 1412969662.95 create unique 169.146.25.112 1412969662.95 don't care what's here

i looking reply in regex please. know can done sort or awk, i've been trying hard work regex , it's hurting brain. give thanks you

an illustration ip address, global search , empty replacement string (dotall alternative must unchecked):

^(\s++).*\r(?=(?>.*\r)*?\1 )

pattern description:

^ # start of line anchor (\s++) # captures non whitespace characters # possessive quantifier '++' forbids backtracking .* # until newline character (dotall mode disable) \r # newline (whatever scheme \r, \r\n, \n) (?= # open lookahead test (?> # open atomic grouping (forbids backtracking 1 time closed) .*\r # line (with next newline) )*? # atomic grouping may occur 0 or more times \1 # backreference capture grouping ) # close lookahead

regex notepad++

No comments:

Post a Comment