In windows using "Windows PowerShell" I used the command mentioned below to achieve this
Get-Content .\file.txt | Group-Object | Select Name, Count
Also we can use the where-object Cmdlet to filter the result
Get-Content .\file.txt | Group-Object | Where-Object { $_.Count -gt 1 } | Select Name, Count