remove lines containing SHA-1 HASH



  • I have many lines with SHA-1 HASH, how can I delete them?

    user:cd7678bcfc4a632943b6d79aaacbab33e0e23da3
    wydawca.lead.network:hots:ip
    name:7ce0359f12857f2a90c7de465f40a95f01cb5da9:hots
    f7ff9e8b7bb2e09b70935a5d785e0cc5d9d0abf0
    tracking.klickthru.com:123.45.160.12

    to

    wydawca.lead.network:hots:ip
    tracking.klickthru.com:123.45.160.12

    thanks to you



  • Hello @ani-rodet and All,

    Just one regex S/R and you’re done :-)

    So :

    • Open the Replace dialoag ( Ctrl + H )

    • SEARCH (?-s)^.*[[:xdigit:]]{40}.*\R

    • REPLACE Leave EMPTY

    • Tick the Wrap around option, if necessary

    • Select the Regular expression search mode

    • Click once on the Replace All button or several times on the Replace button

    Notes :

    • The first part (?-s) ensures that the regex char . will match a single standard character, only ( not EOL ones )

    • Then the part ^.* searches for the longest, even EMPTY, range of characters till …

    • Now, the part [[:xdigit:]]{40} looks for, exactly, 40 hexadecimal characters

    • The final part .*\R selects all the remaining characters of current line with its like break ( \R )

    • The overall match is just deleted as the replacement zone is empty

    Best Regards,

    guy038



  • thanks very much


Log in to reply