Created
March 7, 2018 07:12
-
-
Save timgaunt/b59798b0531d46eb300c1ec1b21c3287 to your computer and use it in GitHub Desktop.
Combine multiple csv or txt files together into one
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$getFirstLine = $true;get-childItem "*.csv" | foreach {$filePath = $_;$lines = $lines = Get-Content $filePath;$linesToWrite = switch($getFirstLine) {$true {$lines}; $false {$lines | Select -Skip 1}};$getFirstLine = $false;Add-Content "combined.csv" $linesToWrite;} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment