删除txt文件中的可变字符

时间:2019-07-05 13:12:51

标签: powershell

我想导入带有某些域的.txt文件,并通过三个nslookup命令获得有关的一些信息。要在.csv中签入后导入数据,我只需要服务器地址而不是先例等等。 最后一个问题是,如何删除“;”之间的所有数字?和“,”

powershell -command "(Get-Content outEOF.txt).Replace(\"nameserver = \", \"\") > tmpOutNS.txt"
powershell -command "(Get-Content tmpOutNS.txt).Replace(\"mail exchanger = \", \"\") > tmpOutME.txt"
powershell -command "(Get-Content tmpOutME.txt).Replace(\"MX preference = \", \"\") > tmpOutMX.txt"
powershell -command "(Get-Content tmpOutMX.txt).Replace(\"`t\", \";\") > tmpOutTab.txt"
powershell -command "(Get-Content tmpOutTab.txt).Replace(\";`\"v\", \"`\"v\") > tmpOutSPF.txt"

这是当前出口:

domain.de;50, MXIN2.somemailer.de; domain.de;10, mail.somemailer.de; domain.de;ns1.virtualhosts.de; domain.de;ns2.virtualhosts.de;

我希望它为

domain.de;MXIN2.somemailer.de; domain.de;mail.somemailer.de; domain.de;ns1.virtualhosts.de; domain.de;ns2.virtualhosts.de;

0 个答案:

没有答案