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,384
  • 1
  • 8
  • 19

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
  • 17,001
  • 56
  • 30
  • 41
0

You can do something like that :

[a-z]+.tradicebk.cz

enter image description here

Hackoo
  • 1
  • 9
  • 22
  • This will only work for the domain `tradicebk.cz` but, as stated in question `I have a file with a random domains` – Toto Nov 04 '21 at 17:05
  • Yep,just because he said in the middle of his question `I need to replace xxxx.tradicebk.cz ` – Hackoo Nov 04 '21 at 17:48