line count

Hello
I just need the line count of the file...
the file is too huge and cant count manually..
Of course i did

wc -l

But this simply got stuck..
Any suggestion...
Tried plenty of option, i know its easy, browsed the google but was not satisfied...

Below commands also will give the line count, but no idea about its perfomance.

grep -c "\n" filename
awk 'END {print NR}' filename

sorry but iam confused, as grep gives different output compare to awk...

Both the commands gave me same output in small file. But I think awk is accurate than grep.

iam not...that means there is some other way to do it....
My files is a huge file...
need to know the exact line count...

Hi

Not sure about the performance. But you can check the other options available here: Different ways to count total lines in a file.

Guru.

did you try

 
# sed -n '$=' hugefile

why not just use your text editor to do it for you? In the options do you not have a "status line" option or anything? or does it HAVE TO BE a command you want?

Did you really enter the command just like that? If you did, then wc is sitting there patiently waiting for input from stdin, and it will wait forever.

wc -l filename
cat filename | wc -l

Exactly how big is this file?
Is it a text file with normal unix text file record terminator of line-feed?
It is fixed length records? If so, you can calculate the number of records without counting them.