From owner-freebsd-questions Fri Nov 9 15:18:34 2001 Delivered-To: freebsd-questions@freebsd.org Received: from smtppop1pub.verizon.net (smtppop1pub.gte.net [206.46.170.20]) by hub.freebsd.org (Postfix) with ESMTP id D583D37B41D for ; Fri, 9 Nov 2001 15:18:31 -0800 (PST) Received: from verizon.net ([199.171.52.20]) by smtppop1pub.verizon.net with ESMTP ; id RAA45009702 Fri, 9 Nov 2001 17:17:22 -0600 (CST) Message-ID: <3BEC628A.5050005@verizon.net> Date: Fri, 09 Nov 2001 18:11:06 -0500 From: Simon Morton Reply-To: smorton@acm.org User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:0.9.5) Gecko/20011011 X-Accept-Language: en,pdf,zh-CN,de-DE,zh-TW,zh, zh-pzõ` MIME-Version: 1.0 To: Odhiambo Washington Cc: FBSD-Q Subject: Re: Help with AWK References: <20011109194842.E27386@ns2.wananchi.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG If I understand correctly, the following should do it: awk -F: '$4==40{printf "^%s@.*\\.wananchi.com$:%s$:%s/:\n",$1,$3,$2;}' HTH Simon Odhiambo Washington wrote: > Hello list, > > I am stuck with awk. > > What I need to do is for awk to read the /etc/master.passwd file and give me a line like > this one below for users whose GID=20 or GID=0 > > I am not able to get the "\" after the ".*" and the $ after wananchi.com and I am also not able to get this done for > users in GID=0 > > ^user2@.*\.wananchi.com$:1234:$1$Tz.OjMPg$5j5pGgjfUHFNlJaSLsr5P/: > > The command I use is: > > awk -F ":" '{if ($$4==20) {print "^"$$1"@.*.wananchi.com"":"$$3":"$$2":"}}' < /etc/master.passwd > some_file > > -Wash > > S y s t e m s A d m i n i s t r a t o r > -- > ~\\_ > Odhiambo Washington \\\\ > Wananchi Online Ltd., `\\\\\ > 1st Flr Loita Hse, Loita Street |\\\\\ > PO Box 10286,00100-NAIROBI,KE. \\\\\|__.--~~\ > Fax: 254 2 313985-9 _--~ / > Fax: 254 2 313922 /~ ////// _-~~~~' > E-mail: wash@wananchi.com ('-//////-// > URL : http://www.wananchi.com //////(((-) > GSM: 254 72 743 223 / 254 733 744 121 /////" > _///" > > +++ > Don't be humble ... you're not that great. > -- Golda Meir > -- http://www.SimonMorton.com smorton at acm dot org \rm -rf /bin/laden To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message