Splitting large file with PowerShell script

$linecount = 0
$filenumber = 1
$content = get-content C:\…\trans.csv | % {
Add-Content C:\…\trans\trans$filenumber.csv “$_”
$linecount ++
If ($linecount -eq 200000) {
$filenumber++
If ($filenumber -eq 4) {Exit}
$linecount = 0
}
}

Full solution can be found here.

Advertisements

About fdtki

Sr. BI Developer | An accomplished, quality-driven IT professional with over 16 years of experience in design, development and implementation of business requirements as a Microsoft SQL Server 6.5-2014 | Tabular/DAX | SSAS/MDX | Certified Tableau designer
This entry was posted in Uncategorized and tagged . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s