change specific line in CSV


hello

here problem know how import csv file , value it, don't know how modify specific value in it.

i have file name log.csv whith field jobname, status, lastdate, freq, errors purpose of file centralized result of powershell script. log used creating a  report

here try

#open file

$file = import-csv c:\temp\logs\jobs.log -delimiter ","

# filter result

$test = $file | select jobname,status,lastdate,freq,errors | {$_.jobname -eq "purges"}

sorry bad bad english

my mistake:

$file = import-csv c:\temp\logs\jobs.log  # filter result $file | foreach {   if($_.jobname -eq "purges log"){$_.status = "ok";$_}   else {$_} } | export-csv -notype c:\temp\logs\jobs.log 



Windows Server  >  Windows PowerShell



Comments

Popular posts from this blog

Edit Group Policy

Hyper-V VM not reaching OS 'Logon' screen

DNS question...