Type:
wc -l foo.txt
And the system returns:
12 foo.txt
Meaning foo.txt has 12 lines.
To count unique lines a file has:
sort -u foo.txt | wc -l
Which will simply exclude all extra lines that are identical.
You should also read:
- PHP: Count Lines of a File and Get the Number of Lines in a Text File
- Simplest PHP Hit Counter or Download Counter – Count the Number of Times of Access (Page Views or File Downloads)
- PHP: Count Words in a String
- PHP: Count the Number of Occurrences of Each Unique Value in an Array
- MySQL, PHP: Display MySQL table fields and data


Facebook
Twitter
Google Plus