Last active
November 17, 2021 07:29
-
-
Save NaClYen/d1b1deb312eaf8352f768fda52a9dedd to your computer and use it in GitHub Desktop.
powershell get file lines for huge file
This file contains 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
Get-File-Lines ./my.log |
This file contains 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
function Get-File-Lines { | |
param ( | |
$FilePath | |
) | |
$n = 0 | |
gc $FilePath -ReadCount 1000 | % { $n += $_.Length } | |
return $n | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment