Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

divide one files depnds on minimum value of a column

Status
Not open for further replies.

tonivm

Technical User
Mar 2, 2006
64
ES
Hi everybody:
Anybody can tell me how from a file like:

2007,7,30,23,0,4,6610,518,286.35,958.73,62.9,,
2007,7,30,23,0,6,6610,531,286.45,957.2,60.9,,
2007,7,30,23,0,6,6610,538,286.55,956.43,59.9,,
2007,7,30,23,0,12,6610,567,286.25,953.14,58.5,,
2007,7,30,23,0,14,6610,576,286.25,952.14,58.4,,
2007,7,30,23,0,15,6610,580,286.15,951.64,58.3,,
2007,7,30,23,0,19,6610,602,286.35,949.14,57.3,46,5.1
2007,7,30,23,0,22,6610,611,286.45,948.14,56.8,,
2007,7,30,23,0,23,6610,616,286.65,947.64,56.6,,
2007,7,30,23,0,28,6610,637,286.45,945.24,55.8,,
2007,7,30,23,0,30,6610,645,286.45,944.34,55.5,46,6.7
2007,7,30,23,0,30,6610,649,286.35,943.89,55.4,,
....
...
..
2007,7,31,0,58,42,6610,35125,241.15,6.04,,,
2007,7,31,0,58,45,6610,35143,241.15,6.02,,,
2007,7,31,0,58,48,6610,35155,241.45,6.01,,,
2007,7,31,0,58,49,6610,35161,241.45,6,,,
2007,7,31,10,58,58,6610,491,291.55,960.8,46,44,3.6
2007,7,31,10,59,0,6610,529,289.25,956.55,42.7,,
2007,7,31,10,59,2,6610,566,289.15,952.32,39.5,,
2007,7,31,10,59,3,6610,585,289.15,950.21,37.8,,
2007,7,31,10,59,8,6610,657,288.85,942.19,36.8,,
2007,7,31,10,59,10,6610,673,288.75,940.47,37.1,,
2007,7,31,10,59,11,6610,680,288.75,939.61,37.3,,
2007,7,31,10,59,15,6610,707,288.35,936.62,38.1,,
2007,7,31,10,59,17,6610,719,288.35,935.36,38.6,,
2007,7,31,10,59,18,6610,724,288.25,934.73,38.8,356,3.1
2007,7,31,10,59,23,6610,754,287.85,931.5,40.1,,
2007,7,31,10,59,25,6610,766,287.75,930.17,40.6,,
...
..
.

Divide it into other files which had determined from the minimum value of the field $8.
Thanks in advance and cheers for everybody. :D
 
tonivm,
given a sample input above... what is the desired output?
your explanation is way too vague even to make any assumptions of what you mean.

vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
Sorry.
I would like to create a differents files everytime that the field 8 will be minimum. This is:

2007,7,30,23,0,4,6610,518,286.35,958.73,62.9,,
2007,7,30,23,0,6,6610,531,286.45,957.2,60.9,,
2007,7,30,23,0,6,6610,538,286.55,956.43,59.9,,
2007,7,30,23,0,12,6610,567,286.25,953.14,58.5,,
2007,7,30,23,0,14,6610,576,286.25,952.14,58.4,,
2007,7,30,23,0,15,6610,580,286.15,951.64,58.3,,
2007,7,30,23,0,19,6610,602,286.35,949.14,57.3,46,5.1
2007,7,30,23,0,22,6610,611,286.45,948.14,56.8,,
2007,7,30,23,0,23,6610,616,286.65,947.64,56.6,,
2007,7,30,23,0,28,6610,637,286.45,945.24,55.8,,
2007,7,30,23,0,30,6610,645,286.45,944.34,55.5,46,6.7
2007,7,30,23,0,30,6610,649,286.35,943.89,55.4,,
2007,7,30,23,0,32,6610,653,286.35,943.44,55.2,,
2007,7,30,23,0,36,6610,669,286.25,941.62,54.8,,
2007,7,30,23,0,39,6610,682,286.15,940.24,54.5,,
2007,7,30,23,0,40,6610,686,286.15,939.78,54.4,50,6.2
2007,7,30,23,0,45,6610,707,285.95,937.38,54.1,,
2007,7,30,23,0,47,6610,716,285.85,936.36,54.1,,
..
..
2007,7,31,0,58,27,6610,35024,240.75,6.12,,,
2007,7,31,0,58,31,6610,35059,240.85,6.09,,,
2007,7,31,0,58,32,6610,35075,240.85,6.08,,,
2007,7,31,0,58,34,6610,35083,240.95,6.07,,,
2007,7,31,0,58,39,6610,35115,240.85,6.04,,,
2007,7,31,0,58,41,6610,35122,241.15,6.04,,,
2007,7,31,0,58,42,6610,35125,241.15,6.04,,,
2007,7,31,0,58,45,6610,35143,241.15,6.02,,,
2007,7,31,0,58,48,6610,35155,241.45,6.01,,,
2007,7,31,0,58,49,6610,35161,241.45,6,,,
2007,7,31,10,58,58,6610,491,291.55,960.8,46,44,3.6
2007,7,31,10,59,0,6610,529,289.25,956.55,42.7,,
2007,7,31,10,59,2,6610,566,289.15,952.32,39.5,,
2007,7,31,10,59,3,6610,585,289.15,950.21,37.8,,
2007,7,31,10,59,8,6610,657,288.85,942.19,36.8,,
2007,7,31,10,59,10,6610,673,288.75,940.47,37.1,,
2007,7,31,10,59,11,6610,680,288.75,939.61,37.3,,
2007,7,31,10,59,15,6610,707,288.35,936.62,38.1,,
2007,7,31,10,59,17,6610,719,288.35,935.36,38.6,,
2007,7,31,10,59,18,6610,724,288.25,934.73,38.8,356,3.1
2007,7,31,10,59,23,6610,754,287.85,931.5,40.1,,
2007,7,31,10,59,25,6610,766,287.75,930.17,40.6,,
2007,7,31,10,59,26,6610,772,287.85,929.5,40.8,,
2007,7,31,10,59,28,6610,782,287.65,928.36,41.1,26,5.1
2007,7,31,10,59,30,6610,793,287.55,927.22,41.4,,
2007,7,31,10,59,32,6610,801,287.55,926.27,41.6,,
..
..

Then I will have in this case, one like first row
2007,7,30,23,0,4,6610,518,286.35,958.73,62.9,,
and the second like:
2007,7,31,10,58,58,6610,491,291.55,960.8,46,44,3.6

I hope you will understand.
Thanks for your patience. Cheers :D
 
sorry,
I still don't understand - hopefully others are not as thick-skulled.

vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
Something like this ?
Code:
awk -F',' 'BEGIN{m=999999999}{if($8<m)out="output"++i;m=$8;print>out}' input

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Hi PHV:
Thanks for your reply. It works perfectlly.
Best regards
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top