[H-GEN] Shell script problem.

Fuzzy BSc. s335810 at student.uq.edu.au
Fri Jun 5 23:52:58 EDT 1998


On Fri, Jun 05, 1998 at 10:02:22AM +0800, Tom Atkinson wrote:

> BEGIN { flag=0 }
> 
> {
>  if (flag == 0 || $2 < smallest)
>     {
>      flag = 1;
>      smallest = $2;
>      lineno = $1;
>     }
> }           
> 
> END { print lineno, smallest }

Once again, awk proves it's simplicity and utility for tasks which -should-
be simple :)

I use awk for many of these kinds of applications.  It's far simpler to
learn than perl, and although it isn't as powerful, it does the jobs which
you actually want done.

I'm probably not the resident awk guru, but I'm the resident awk advocate,
so if you are interested in learning, feel free to come talk to me.


  fuzzy BSc.

             //     //  //     //     //     ///   //  //
            // //  //  // //  // //  //    // //  //  //
           //         //     //           //         //
          // //  //  // //  // //  //    //         /
         //     //  //     //     //  ////      ///

     <A href="http://student.uq.edu.au/~s335810">www</A>
    <A href="mailto:s335810 at student.uq.edu.au">mail</A>



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



More information about the General mailing list