Код: Выделить всё
PS> "Apr 17 06:08:40 mail pop3d-ssl: LOGIN, user=username@domain.ru, ip=[::ffff:192.168.0.100], port=[56795]" -replace ".+user=(.+), ip.+",'$1'
username@domain.ruКод: Выделить всё
PS> "Apr 17 06:08:40 mail pop3d-ssl: LOGIN, user=username@domain.ru, ip=[::ffff:192.168.0.100], port=[56795]" -replace ".+user=(.+), ip.+",'$1'
username@domain.ruКод: Выделить всё
(Get-Content file.txt) -replace 'регулярное_выражение','замена' | Set-Content file.txtКод: Выделить всё
(Get-Content file.txt) -replace 'регулярное_выражение','замена' | Out-File file.txt -Encoding utf8Код: Выделить всё
$i = (Get-Content file.txt) -replace 'регулярное_выражение','замена'
Set-Content file.txt -Encoding utf8 -Value $i