A
A
Alina Andreeva2017-09-11 12:31:38
PowerShell
Alina Andreeva, 2017-09-11 12:31:38

How to batch edit csv with Powershell?

Good afternoon! It is necessary in a large number of csv files to batch replace , with ; for the correct display of the report in excel - how to do it as simply and quickly as possible or what to build on in the script?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
C
Crovax, 2017-09-11
@linacat2305

Get-ChildItem *.csv | ForEach-Object { (Get-Content -Path $_.FullName) -replace ',', ';' | Set-Content -Path $_.FullName }

A
Alina Andreeva, 2017-09-11
@linacat2305

as a result my working variant - replacement of symbols + renaming of the file
cd c:\ps
Get-ChildItem *.csv | ForEach-Object { (Get-Content -Path $_.FullName) -replace '","', '";"' | Set-Content -Path "c:\PS\10.09.2017\Spb\10.09.2017_$($_.Name)" }

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question