Hi,
I have a file which has 4500 entries
10000
9880
9800
8700
8200
...
.....
...
...
...
...
...
...
...
50
What I need is for every one percentile count number of rows falling into that interval
output
10000-9900 1
9899-9800 2
9799-9700 0
so on...
Thanks,
Quick and dirty ..
Assuming ur input is in a file called t1
Paste the below in a file
#!/bin/ksh
sort -n t1|grep . > t2.tmp
maxval=`tail -1 t2.tmp`
count=0
endv=$maxval
let startv=$maxval/100
let startv=$startv*100
let endv=$startv+99
while test $endv -ge 99
do
cat t2.tmp|while read line
do
if test $line -ge $startv && test $line -le endv
then
let count=$count+1
fi
done
echo "${startv}"-"${endv}" "$count" >> Summary.txt
count=0
let startv=$startv-100
let endv=$endv-100
done
The output should be in Summary.txt