在Powershell中仅提取csv文件的前10行 [英] Extract only the first 10 lines of a csv file in powershell

查看:501
本文介绍了在Powershell中仅提取csv文件的前10行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个csv文件,并想输出一个新的csv文件,该文件仅包含原始行的前10行. 到目前为止,我仅找到删除单行或包含特定单词的行的代码.它可能是15个字符的单线,但我不确定该如何处理,任何帮助将不胜感激.我不希望您编写代码,只是正确的命令可以帮助我.

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.

推荐答案

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

做到了

这篇关于在Powershell中仅提取csv文件的前10行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆