ファイルがあります。いくつかの連続した文字列を選択し、それらを結合して、powershell スクリプトで選択した文字列の最初の場所にファイルに配置する必要があります
私は試します:
$test=cat $file |select-string -pattern '<DIV>$' -Context 0,1|%{$_ -split "\r\n"}
$t= -join ($test[0],$test[1])
cat $file|%{$_ -replace '$test','$t'} > temp.txt
またはこれ
cat $file | %{$_ -replace '<DIV>[\u000d\u000a]{0,2}',""}>temp.txt
しかし失敗する