Created
December 22, 2016 12:32
-
-
Save cemremengu/fe1118af20e40e4e36a7fa82e7af5306 to your computer and use it in GitHub Desktop.
powershell script for counting the lines of a large 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
$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