Given an input file containing one single number per line, how could I get a count of how many times an item occurred in that file?
cat input.txt 1 2 1 3 1 0
desired output (=>[1,3,1,1]):
cat output.txt 0 1 1 3 2 1 3 1
It would be great, if the solution could also be extended for floating numbers.
Converting from raw data with possible repetitions to a frequency table is relatively simple. First copy the data scores (using Paste Values if necessary) to a new place in the worksheet. Then select this range of cells and click on Data > Data Tools|Remove Duplicates.
You mean you want a count of how many times an item appears in the input file? First sort it (using -n
if the input is always numbers as in your example) then count the unique results.
sort -n input.txt | uniq -c
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With