Skip to content

Instantly share code, notes, and snippets.

@NaClYen
Last active November 17, 2021 07:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NaClYen/d1b1deb312eaf8352f768fda52a9dedd to your computer and use it in GitHub Desktop.
Save NaClYen/d1b1deb312eaf8352f768fda52a9dedd to your computer and use it in GitHub Desktop.
powershell get file lines for huge file
Get-File-Lines ./my.log
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