Skip to content

Instantly share code, notes, and snippets.

@cemremengu
Created December 22, 2016 12:32
Show Gist options
  • Save cemremengu/fe1118af20e40e4e36a7fa82e7af5306 to your computer and use it in GitHub Desktop.
Save cemremengu/fe1118af20e40e4e36a7fa82e7af5306 to your computer and use it in GitHub Desktop.
powershell script for counting the lines of a large file
$YOURFILE = "example.txt";
$nlines = 0;
#read file by 1000 lines at a time
gc $YOURFILE -read 1000 | % { $nlines += $_.Length };
[string]::Format("{0} has {1} lines", $YOURFILE, $nlines)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment