[H-GEN] Shell script problem.

Chris Ryan cryan at plugged.net.au
Thu Jun 4 21:08:30 EDT 1998


Andrae Muys wrote:
> 
> Ok, so I'm rather shocking at shell scripts :).  So far I've been able to
> reduce a massive log file to a series of number pairs (representing the
> line number (grep -n :) and an error number (target)).  What I need to do
> is return the line number of the smallest error.  The problem is that the
> number is a float.  ie.
> 
> 14 3.63234e+07
> 28 3.54324e+07
> 36 3.34564e+07
> 52 3.52345e+07

adding the following line for demo purposes:

66 3.33333e+08

> 
> Now short of writing a C program to do the final step, can anyone help?

Possibly. Maybe use sort with a separator of "+", on the 2nd column -
this will give you the smallest exponential.  From there, sort the
duplicates with a separator of " " - only do this for the first
set of duplicates - haven't quite worked out how to do that.  
The first entry after this is then your answer.

--
Chris Ryan
cryan at plugged.net.au

----------------------- HUMBUG General List --------------------------------
echo "unsubscribe general" | mail majordomo at humbug.org.au # To Unsubscribe



More information about the General mailing list