the number of lines as metadata for each file.

iamavdhutpandit

New Member
Joined
May 17, 2022
Messages
1
Reaction score
0
Credits
11
How to get the total number of lines in a file faster in Linux. Considering the number of lines in the file is around 100 million. wc -l takes a lot of time.
 


I'd think wc is the standard for a task like this. But are all of the lines the same length? If so, you could divide the file size by the line length to get number of lines.
 
I just tried the answer here and it seemed really speedy, and timing it says it's faster.


It's pretty easy to follow.
 

Staff online

Members online


Top