1

I have a file with a random domains like this:

    host-name                           estkowjf.tradicebk.cz
    domain-key                          smtp,*,/home/pmta/keys/dkim.pem
</virtual-mta>
    host-name                           itaquearuem.tradicebk.cz
    domain-key                          smtp,*,/home/pmta/keys/dkim.pem
</virtual-mta>
    host-name                           inventorecnjof.tradicebk.cz
    domain-key                          smtp,*,/home/pmta/keys/dkim.pem

I need to replace xxxx.tradicebk.cz with a simple domain like so:

    host-name                         mydomain.com
    domain-key                          smtp,*,/home/pmta/keys/dkim.pem
</virtual-mta>
    host-name                           mydomain.com
    domain-key                          smtp,*,/home/pmta/keys/dkim.pem
</virtual-mta>
    host-name                           mydomain.com
    domain-key                          smtp,*,/home/pmta/keys/dkim.pem

How I can do that?

Randomhero
  • 1,543

2 Answers2

1
  • Ctrl+H
  • Find what: host-name\h+\K\S+
  • Replace with: mydomain.com
  • CHECK Match case
  • CHECK Wrap around
  • CHECK Regular expression
  • UNCHECK . matches newline
  • Replace all

Explanation:

host-name       # literally
\h+             # 1 or more horizontal spaces
\K              # forget all we have seen until this position
\S+             # 1 or more non-space characters

Screenshot (before):

enter image description here

Screenshot (after):

enter image description here

Toto
  • 19,304
0

You can do something like that :

[a-z]+.tradicebk.cz

enter image description here

Hackoo
  • 1,410