in reply to Trouble sorting a nested HOH
Now, are you supposed to be sorting according to the "cnt" value within each "pid" paragraph? Or are you supposed to sort the pid paragraphs within a given "rip" section according to which pid has the highest "cnt" value? Or are you supposed to sort the "Remote host" sections according to which one has the highest "cnt" value?Report on remote host: (some.host) pid: (some pid) some socket statistics some more socket statistics ... pid: (some other pid) still more socket statistics had enough socket statistics? ... Report on remote host: (another.host) pid: (yet another pid) ... ...
Or maybe you don't really want the output to be structured that way? If you want each "rip/pid/socktype" ordered according to its respective "cnt" value (that is, it's okay that various lines for "rip X" are interleaved with lines for "rip Y" because of their "cnt" rankings), then you just come up with a suitable report line format that keeps all the information together on each line, use your loop to "sprintf()" each report line onto an array, then sort the array before you print it.
Once you clarify what you're trying to do, the answer should come pretty quickly.
(updated to fix grammar)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Trouble sorting a nested HOH
by mielstogo (Initiate) on Nov 28, 2007 at 04:55 UTC | |
by mielstogo (Initiate) on Nov 28, 2007 at 05:07 UTC |