top of page

Powershell script to split up .csv file


The PowerShell script posted here by Jose Barreto can be used to split up a large .csv file that is difficult to open in Excel.

In this example we have a .csv file which has dates in the first column.

Enter the following script in PowerShell, listing the path of the source file [C:\FooFolder\2019.12.04\Book1.csv]; the date to split by [gt [datetime] "02/15/2010"]; and then the output file [C:\FooFolder\2019.12.04\Book1split2.csv]

$l=0; type C:\FooFolder\2019.12.04\Book1.csv | ? { ($l++ -eq 0) -or ([datetime] $_.Split(",")[0] -gt [datetime] "02/15/2010") } | Out-File C:\FooFolder\2019.12.04\Book1split2.csv -Encoding utf8

A new file will be generated that contains only the data from the first, with the entries after 2/15/2010 in the first column.


Sean O'Shea has more than 20 years of experience in the litigation support field with major law firms in New York and San Francisco.   He is an ACEDS Certified eDiscovery Specialist and a Relativity Certified Administrator.

​

The views expressed in this blog are those of the owner and do not reflect the views or opinions of the owner’s employer.

​

If you have a question or comment about this blog, please make a submission using the form to the right. 

Your details were sent successfully!

© 2015 by Sean O'Shea . Proudly created with Wix.com

bottom of page