PowerShell 获取大文件行数

function fn-GetLineCount ($FilePath)
{
$nlines = 0;
gc $FilePath -read 1000 | % { $nlines += $_.Length };
[string]::Format("{0} has {1} lines", $FilePath, $nlines)
}

 

使用例子:

fn-GetLineCount "C:\output.csv"

posted @ 2017-02-02 13:58  BI-Info  阅读(2590)  评论(0编辑  收藏  举报