- 702 名前:639 [2018/04/01(日) 14:11:02.57 ID:y3W5ZkrO.net]
- 最後の空白行orNull行の判定もいれてみたんだけど
function newfile{ param($text="てすと") process{ if($_.ToString().Contains($text)){$newline=$text} else{$newline=$_} $newline } #end{ if( -NOT $newline.Contains($text)){$text} } end{ if(-NOT($newline.Contains($text) -or [string]::IsNullOrWhiteSpace($newline)) ){$text}} } $list=Get-Content 入力ファイル $newlist=$list|newfile
|

|