【发布时间】:2017-03-16 16:08:34
【问题描述】:
我有这个电子邮件地址列表。
我想删除所有域扩展。
Input.csv
john@email.com
albert@mail.co.uk
al@hotmail.nl
commadore@gmail.al
应该导致:
输出.csv
约翰@电子邮件
阿尔伯特@邮件
al@hotmail
commadore@gmail
如果我使用此代码...
$Sourcefile = 'C:\PS\Input.csv'
$Output = 'C:\PS\Output.csv'
(Get-Content $Sourcefile) | Foreach-Object {
$_ -replace '.com', ''`
-replace '.co.uk', ''`
-replace '.nl', ''`
-replace '.al', ''
} | Set-Content $Output
.. 我得到:
Output.csv
约翰@电子邮件
bert@mail - (al 已删除)
al@hotmail
madore@gmail - (com 已删除)
有谁能帮忙吗?
【问题讨论】:
标签: powershell csv email dns