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

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

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

fascinating rhythm


Moderator


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

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


Powershell
Код: Выделить весь код
function Split-Png {
param(
[parameter(mandatory=$true)]
$file,
[parameter(mandatory=$true)]
$filter,
$includeFilter
)
    if ($includeFilter) {
        $blocks = ((gc $file) -split "(?=$filter)") -ne ''
    }
    else {
        $blocks = ((gc $file) -split "$filter") -ne ''
    }
    
    $folder = (Get-Item $file).DirectoryName
    $c = 1
    
    $blocks |% {
        $_ |Out-File "$folder\out$c.png"
        $c++
    }
}

# Не включать фильтр
Split-Png -file "C:\temp\file.txt" -filter "0"

# Включить фильтр
Split-Png -file "C:\temp\file.txt" -filter "0" -includeFilter 1

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

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

Отправлено: 08:23, 11-09-2022 | #2