Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Faster Line Count With Grep Rather Than Wc

DZone's Guide to

Faster Line Count With Grep Rather Than Wc

·
Free Resource
wc 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
Topics:

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}