Имя пользователя:
Пароль:
 

Показать сообщение отдельно

Аватара для DJ Mogarych

fascinating rhythm


Moderator


Сообщения: 6705
Благодарности: 1576

Профиль | Отправить PM | Цитировать


Код: Выделить весь код
$file = "C:\temp\1.txt"
$names = "C:\temp\2.txt"

$equals = [System.Collections.ArrayList]::new()
$notEquals = [System.Collections.ArrayList]::new()
[io.file]::readalllines("$file") |% {
    if (($str = $_.split(' | ') -match '\w' |group {$_ -replace '\.\w+$'})[0].Count -eq 1) {
        $notEquals.add($_) > $null 
    }
    else {
        $equals.add($($str.name -replace '.*/' -replace '$','*')) > $null        
    }
}

$notEquals |Out-File $file -Encoding default
$equals -join ';' |Out-File $names -Encoding default

-------
Powershell 7.x | Powershell 5.1 | ffmpeg (docs)

Это сообщение посчитали полезным следующие участники:

Отправлено: 20:43, 24-12-2023 | #2