powershell - select -first 1 on a large file -


i trying run following command on large text file. however, it's slow

((cat largefile.txt | select -first 1).split(",")).count() 

is alternative fast way in powershell? seems command scan whole file no matter what.

to first x number of lines in text file, use –totalcount parameter:

((get-content largefile.txt -totalcount 1).split(",")).count 

Comments

Popular posts from this blog

JQuery Autocomplete without using label, value, id -

c++ - Accessing inactive union member and undefined behavior? -

JAVA - what is the difference between void and boolean methods? -