From owner-freebsd-questions Tue May 15 19: 8:30 2001 Delivered-To: freebsd-questions@freebsd.org Received: from shell.amplespace.com (shell.amplespace.com [64.124.189.67]) by hub.freebsd.org (Postfix) with ESMTP id 98D0637B423 for ; Tue, 15 May 2001 19:08:17 -0700 (PDT) (envelope-from don@whtech.com) Received: from digerati (outside.router.amplespace.com [209.172.105.110] (may be forged)) by shell.amplespace.com (8.9.3/8.9.3) with SMTP id TAA38412; Tue, 15 May 2001 19:04:44 -0700 (PDT) (envelope-from don@whtech.com) From: "Don O'Neil" To: "Sue Blake" , "Don O'Neil" Cc: Subject: RE: Help w/ Awk Date: Tue, 15 May 2001 19:08:10 -0700 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) In-reply-to: <20010516115758.L26110@welearn.com.au> X-MIMEOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 Importance: Normal Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG That's a simpler way of doing it, but doesn't accomplish what I'm trying to do. I'm trying to be able to loop through each user and get it's UID/GID and do stuff... My problem wasn't with my AWK statement, but with my for/next loop. For whatever reason (still unknown), the for Line in Password was failing, and was returning multiple lines, like there were EOL's embedded in the lines. I ended up doing a hybrid of your technique... first stripping the /etc/password of the 3 components I needed and making a new file, then looping through the lines it it. Weird. Don > -----Original Message----- > From: owner-freebsd-questions@FreeBSD.ORG > [mailto:owner-freebsd-questions@FreeBSD.ORG]On Behalf Of Sue Blake > Sent: Tuesday, May 15, 2001 6:58 PM > To: Don O'Neil > Cc: freebsd-questions@FreeBSD.ORG > Subject: Re: Help w/ Awk > > > On Tue, May 15, 2001 at 06:09:34PM -0700, Don O'Neil wrote: > > I'm trying to write a simple script to extract the user name, > UID and GID of > > each user in the /etc/passwd file and I'm not quite sure what I'm doing > > wrong here.... here's a code snippet; > > Why not just use this: > > awk -F: '{print $1 " " $3 " " $4}' < /etc/passwd > > Works for me every time. > You could use another delimiter in your output instead of " " spaces. > > -- > > Regards, > -*Sue*- > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-questions" in the body of the message > > To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message