binning iteratively row wise
Hi
I have a file some thing like below. I want to bin the data. My Bin size is 100. Code:
items number Code:
bin_75-175.txt Code:
Code:
bin_88-188.txt |
Quote:
|
Code:
awk '{f=sprintf("%d", 1+$2/100); fn[f]="bin"f"_"; print $1,$2>>fn[f]}' file_name Code:
0-100,100-200 Code:
75-175 |
Well I am not understanding how the ranges are selected, but as your first example also required the data to be sorted, I would suggest storing the necessary data in arrays and then
in the END section you will need to loop over the data and use an 'if' clause(s) or maybe a select / case to allow you to branch the data into the necessary files. |
All times are GMT -5. The time now is 12:56 PM. |