[H-GEN] Shell script problem.

Nathan Keynes nkeynes at mailbox.uq.edu.au
Thu Jun 4 21:31:49 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
> 
> Now short of writing a C program to do the final step, can anyone help?
> 
> (I'd work it out for myself, except it isn't _my_ problem, I'm just
> helping out a friend and I don't have the time to stuff around with it
> anymore)
> 
> Andrae

Hi,
  Well one way... :)
  cat data | sed -e 's/ \(.*\)e+\(.*$\)/ \2 \1/' | sort +1 | head -n1 |
       cut -d\  -f1
Regards,
Nathan
nkeynes at mailbox.uq.edu.au

--
Close your eyes, and imagine... that you can see a really cool .sig
here...

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



More information about the General mailing list