我收到了這個電子郵件地址列表。
我想刪除所有域擴展名。
Input.csv
[email protected]
[email protected]
[email protected]
[email protected]
應導致:
PowerShell:刪除電子郵件列表中的域名擴展
Output.csv
john @ email
阿爾伯特@郵件
人@ 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
john @ email
bert @ mail - (al被刪除)
人@ hotmail的
馬度爾@ gmail的 - (COM被刪除)
任何人能幫助我們嗎?
謝謝! :)超級開心:) – Hogne