Date: Tue, 15 May 2001 19:08:10 -0700 From: "Don O'Neil" <don@whtech.com> To: "Sue Blake" <sue@welearn.com.au>, "Don O'Neil" <don@whtech.com> Cc: <freebsd-questions@FreeBSD.ORG> Subject: RE: Help w/ Awk Message-ID: <MOBBIPGJKBNNPGLGMFHFCEIFHCAA.don@whtech.com> In-Reply-To: <20010516115758.L26110@welearn.com.au>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?MOBBIPGJKBNNPGLGMFHFCEIFHCAA.don>