Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Import and Modify CSV

$
0
0

Normal 0 false false false EN-US X-NONE X-NONE

Hi,

I am trying to read the CSV file, split the Content from TimeStamp (1/2/2013  8:00:00 AM ) Column and save it back to same CSV with date and time in two different Column.

So far this is what I ‘ve got but I am not sure how to add the values back to the file.

$filename = Import-CSV “CSVFILE.csv”

$date= $ filename | %{ ($_.TimeStamp).Split(' ')[0]}

$time= $ filename | %{ ($_.TimeStamp).Split(' ')[1]}

 

So the output should look like

Date                      Time

------                      --------

1/2/2000              8:00:00AM

1/3/2000              3:00:00AM

1/4/2000              4:00:00AM

1/5/2000              5:00:00AM

Thanks,


Viewing all articles
Browse latest Browse all 6937

Trending Articles