how to compare two lines which is having nos

August 29, 2010 at 23:12:23
Specs: Unix
Hi all,

I am trying to achieve the following output but i am not able to do. If someone can please guide me to do it.

INPUT:

count name Description
1 abcd - CPU Load is 70.8
1 dcd - Memory Utilization is 96.57%
2 gghh - CPU Utilization is 97.61%
1 gghh - CPU Utilization is 97.67%

OUTPUT

count name Description
1 abcd - CPU Load is 70.8
1 dcd - Memory Utilization is 96.57%
3 gghh - CPU Utilization is 97.67%

The script has to find the lines matching with same text except numeric values by comparing that values it has to keep line which is having biggest value and remove the rest and the count on the count column.

Please guide me


See More: how to compare two lines which is having nos

Report •

#1
August 30, 2010 at 14:27:45
If the input data is sorted, then I would design a break point report script. This link might get you started:

http://www.computing.net/answers/so...


Report •

#2
August 30, 2010 at 19:38:16
Thank u very much for ur reply nails !!! in what way u need to sort... i hope its already sorted ... ...
for eg:
1 abcd - cpu load is 80%
1 abcd - cpu utilization is 90% these two are different.. i dont want to merge it.

but in another case

input

1 abcd - cpu load is 80%
1 abcd - cpu load is 90%
i want to merge it and highest value should be there and also count need to be increased.

output:
2 abcd - cpu load is 90%

another case :

2 abcd - cpu load is 80%
1 abcd - cpu load is 90%
1 abcd - cpu utilization is 90%


output:

3 abcd - cpu load is 90%
1 abcd - cpu utilization is 90% .... i need to differentiate with that metrics and host names .... i hope u understand this .... Is it possible ?


Report •
Related Solutions


Ask Question