Имя пользователя:
Пароль:  
Помощь | Регистрация | Забыли пароль?  

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

Новый участник


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

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


Цитата Serguei Kouzmine:
очень интересно »
Код: Выделить весь код
$inputFile = "C:\path\input.txt"
$outputFile = "C:\path\output.txt"

(Get-Content $inputFile) | ForEach-Object {$_ -replace "@", "asd@"} | Set-Content $outputFile



$input_file = "C:\path\input.txt"
$output_file = "C:\path\output.txt"

Get-Content $input_file | ForEach-Object {
    $parts = $_ -split "@"
    $newLine = $parts[0] + "asd@" + $parts[1]
    $newLine | Add-Content $output_file
}



$inputFile = 'C:\path\input.txt'
$outputFile = 'C:\path\output.txt'

Get-Content $inputFile | ForEach-Object {
    $line = $_
    $pos = $line.IndexOf('@')
    if ($pos -ge 0) {
        $line = $line.Insert($pos + 1, 'asd')
    }
    $line
} | Set-Content $outputFile
Код: Выделить весь код
@echo off
setlocal enabledelayedexpansion

set input_file=input.txt
set output_file=output.txt

(for /f "tokens=1,* delims=@" %%a in (%input_file%) do (echo %%aasd@%%b)) > %output_file%
Это сообщение посчитали полезным следующие участники:

Отправлено: 07:49, 15-02-2023 | #15