Path: utzoo!utgpu!attcan!uunet!seismo!sundc!pitstop!sun!amdcad!ames!pasteur!ucbvax!bloom-beacon!bu-cs!madd From: madd@bu-cs.BU.EDU (Jim Frost) Newsgroups: comp.unix.questions Subject: Re: accessing shell variables from within awk? Message-ID: <25133@bu-cs.BU.EDU> Date: 29 Sep 88 04:47:14 GMT References: <473@diamond.unix.ETA.COM> Reply-To: madd@bu-it.bu.edu (Jim Frost) Followup-To: comp.unix.questions Distribution: na Organization: Boston University Distributed Systems Group Lines: 16 In article <473@diamond.unix.ETA.COM> rscott@eta.unix.ETA.COM (Rich Scott) writes: | | How can I access a shell variable (to wit, a few environment |variables) from within "awk"? The simplest way is: set shellvar = "foo" awk 'BEGIN { foo == ' $shellvar ' ; \ print foo \ }' You could similarly unquote and quote for every occurance of "foo". jim frost madd@bu-it.bu.edu