How to find duplicate line in log file?

Hi guys, I'm really happy to find this forum

I have a log file, and I have to find all lines that have "error" word, and then save this output in file, the output file has to have just only one line to any Duplicated lines and counter that show how many time this lines duplicated?

I already did the grep, and sort the file? now I don't know how can I find the duplicated lines and counter for that?

any help or idea

thanks a lot.

cat filename | sort | uniq -c

wow that is really fast, thank you,

I will try it, I use Bourne Shell

I hope it will work