Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84 exptools; site ihlpm.UUCP Path: utzoo!watmath!clyde!burl!ulysses!mhuxr!mhuxn!ihnp4!ihlpm!rdkuphal From: rdkuphal@ihlpm.UUCP (heading) Newsgroups: net.unix Subject: Re: AWK question Message-ID: <419@ihlpm.UUCP> Date: Fri, 16-Aug-85 12:58:07 EDT Article-I.D.: ihlpm.419 Posted: Fri Aug 16 12:58:07 1985 Date-Received: Tue, 20-Aug-85 04:20:30 EDT References: <436@brl-tgr.ARPA> Organization: AT&T Bell Laboratories Lines: 24 > Does anyone know if and how I can get awk to do a >= (less than or equal) > on a value entered from a terminal by the user? > E.G. > echo 'enter date in format yy-mm-dd \c $dt' > read dt > echo $dt > awk '$5 >= $dt ' .suspfile >xout > > awk seems to ignore the terminal entered data. Is there any way to get > awk to recognize this kind of variable? > > ed daly > ddaly at amc-hq You just past the prompts reply into AWK as a parameter, as follows: echo 'enter date in format yy-mm-dd \c $dt' read dt echo $dt awk '$5 >= $x ' x=$dt .suspfile >xout The reference to x may be just x instead of $x, I can't remember at this time. You may pass as many parameters as you desire, seperated with white space.