Faster Line Count With Grep Rather Than Wc
Join the DZone community and get the full member experience.
Join For Freewc can be dramatically slower than desirable if all you want is a count of lines in a file (e.g., ~6 minutes vs. the grep technique shown below, which took 10 seconds).
grep -c '\n' filename
Grep
Opinions expressed by DZone contributors are their own.
Comments