Answer the question
In order to leave comments, you need to log in
C# How to find a block of text in a file and replace multiple duplicate lines?
Good day, dear users, faced such a problem.
I have a file operator.rl
With this content
ID=cc7d5671-b10f-4da5-a4ee-f16dc89bfe16
InfComType=EnterpriseRate
INN=
Key=EnterpriseRate_1BN
LastName=
MiddleName=
Name= SERVER1
POPPort=110
POPServer= server1.pop.ru
Post=
SMTPPort= 25
SMTPServer=server1.smtp.ru
Type=Operator
ID=2eab72f5-324f-429d-9746-1662b62e25f9
InfComType=EnterprisePfr
INN=
Key=EnterprisePfr_
LastName=
MiddleName=
Name= SERVER2
POPPort=110
POPServer= 92.255.247.94
Post=
SMTPPort=25
SMTPServer= 92.255.247.94
Type=Operator
How can I take these lines from a file and change servers and ports to different ones.
POPPort=110
POPServer= server1.pop.ru
SMTPPort=25
SMTPServer=server1.smtp.ru
POPPort=110
POPServer= 92.255.247.94
SMTPPort=25
SMTPServer= 92.255.247.94
I have a mechanism to check server availability, I just need to fetch these lines and replace the servers if they are not available
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question