View Single Post
Join Date: Apr 2006
Posts: 148
Reputation: ghostdog74 is on a distinguished road 
Solved Threads: 40
ghostdog74 ghostdog74 is offline Offline
Junior Poster

Re: Urgent: Help on grep the nearest value using bash script

 
0
  #4
Apr 5th, 2008
Shell Scripting Syntax (Toggle Plain Text)
  1. awk '$NF <=3 {a[NR]=$NF;c[a[NR]]=$0}
  2. END{
  3. n=asort(a,b)
  4. print c[b[n]]
  5. }' file
output:
Shell Scripting Syntax (Toggle Plain Text)
  1. # ./test.sh
  2. 18 126 2833 30 0.010479 2.842
Reply With Quote