gravatar for arsala521

2 hours ago by

Hello everyone,

I want to use awk to count number of values within a range in a specific column, and to print ranges with the count in output. For example, 4th column of my input is like this

1000
4000
5001
7050
4000
3500

With bin size of 5000, I want to know the number of values in range 1 - 5000, 5001 - 10000 and so on. My values are greater than 100,000. I want to count the values as many times as they appear. For example 4000 should be counted twice. The output should be showing two columns showing ranges and the count like

1000-5000 4
5000-10000 2

I found many relevant answers on different forums but nothing exactly serves my purpose. I found one code but it is counting duplicate values only once.

Thanks

link

modified 55 minutes ago

by

zx87548.9k

written
2 hours ago
by

arsala52110



Source link