Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Extract only the first 10 lines of a csv file in powershell

Tags:

powershell

csv

I have csv file and want to output a new csv file, that only contains the first 10 lines form the original one. I've so far only found code to delete single lines or lines that contain a certain word. Its probably a 15 character one-liner, but I am not sure how to approach this, any help would be greatly appreciated. I don't expect you to write code, just the right command would help me out.

like image 540
Monacco Franze Avatar asked Mar 06 '15 22:03

Monacco Franze


People also ask

How do I select the first 10 rows in PowerShell?

In PowerShell to select first 10 lines of file, use Get-Content command with Select -First parameter with value 10.


1 Answers

Get-Content "C:\start.csv" | select -First 10 | Out-File "C:\stop.csv" 

That did it

like image 129
Monacco Franze Avatar answered Sep 22 '22 11:09

Monacco Franze