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

后端 未结 5 1625
没有蜡笔的小新
没有蜡笔的小新 2021-01-31 02:54

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

5条回答
  •  生来不讨喜
    2021-01-31 03:01

    You can also use

    (Get-Content yourfile.csv)[0 .. 11]>outputfile.csv
    

    Be sure to include the header row or you could run into issues. You can also change the numbers to get whatever rows you want. The first and head flags did not work for me.

提交回复
热议问题