Getting Approximate Row Count of a Huge File

chncaesar發表於2013-11-12

This blog is originated from stackoverflow.com

Step 1: head -n filename > newfile // get the first n lines into newfile,e.g. n =5

Step 2: Get the huge file size, A

Step 3: Get the newfile size,B

Step 4: (A/B)*n is approximately equal to the exact line count.

Set n to be different values,done a few times more, then get the average.

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/638844/viewspace-776435/,如需轉載,請註明出處,否則將追究法律責任。

相關文章