Assuming there is one number per line:
sort <file> | uniq -c
You can use the more verbose --count
flag too with the GNU version, e.g., on Linux:
sort <file> | uniq --count
More Related Contents:
- How do I find files that do not contain a given string pattern?
- Batch file to delete first 3 lines of a text file
- How can I tell how many objects I’ve stored in an S3 bucket?
- How to find the largest file in a directory and its subdirectories?
- How do I find the current directory of a batch file, and then use it for the path?
- FileNotFoundError: [Errno 2] No such file or directory [duplicate]
- In MATLAB, can I have a script and a function definition in the same file?
- Skip first couple of lines while reading lines in Python file
- Find file name from full file path
- Script to associate an extension to a program
- Trying to copy file from one XP PC to another using WMI, since RPC and UNC are not available
- Finding duplicate files and removing them
- Get file version in PowerShell
- How to read/write from/to a file using Go
- How can I find encoding of a file via a script on Linux?
- for IE gives full path, need file name only
- JVM property -Dfile.encoding=UTF8 or UTF-8?
- Force download of ‘data:text/plain’ URL
- Write variable to a file in Ansible
- Detect duplicate MP3 files with different bitrates and/or different ID3 tags?
- How to move/rename a file using an Ansible task on a remote system
- Log4Net config in external file does not work
- Parse a log4j log file
- Keep CMD open after BAT file executes
- Find all CSV files in a directory using Python
- split file on Nth occurrence of delimiter
- count files in specific folder and display the number into 1 cel [closed]
- Comparing folders and content with PowerShell
- CMake: reuse object files built for a lib into another lib target
- What is a sparse file and why do we need it?