Delete first two columns in CSV with PowerShell -


i need delete first 2 columns in csv. not know header names, not static. figured out how remove first 2 rows, not first 2 columns. sample code working below

$csv     = import-csv 'input.csv' $headers = $csv[0].psobject.properties | select -expand name $step    = 4  ($i = 0; $i -lt $headers.count; $i += $step) {   $csv | select $headers[$i..($i+$step-1)] |     export-csv "output_$($i/$step).csv" -notype } 

this seems work:

$csv     = import-csv 'input.csv' $include = $csv[0].psobject.properties | select -expandproperty name -skip 2 $csv | select $include -skip 2 | export-csv output.csv -notypeinformation 

that should take care of pruning off first 2 columns , skipping first 2 rows.


Comments

Popular posts from this blog

python - mat is not a numerical tuple : openCV error -

c# - MSAA finds controls UI Automation doesn't -

wordpress - .htaccess: RewriteRule: bad flag delimiters -