From owner-freebsd-questions Tue May 15 18:34:34 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 4FC9837B422 for ; Tue, 15 May 2001 18:34:30 -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 SAA29942; Tue, 15 May 2001 18:31:03 -0700 (PDT) (envelope-from don@whtech.com) From: "Don O'Neil" To: "Dave Leimbach" Cc: Subject: RE: Help w/ Awk Date: Tue, 15 May 2001 18:34:29 -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: <200105160124.UAA18584@MPI-Softtech.Com> X-MIMEOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 Importance: Normal Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Also... as indicated by the man page, there are problems with the -F option, listed in the BUGS section: "The -F option is not necessary given the command line variable assignment feature; it remains only for backwards compatibility." I'm using FreeBSD 3.3 on that particular system. > -----Original Message----- > From: Dave Leimbach [mailto:dleimbac@MPI-Softtech.Com] > Sent: Tuesday, May 15, 2001 6:24 PM > To: don@whtech.com > Cc: questions@freebsd.org > Subject: Re: Help w/ Awk > > > read man for awk... look for field separator... :) > > have a nice day. > > Dave > >Delivered-To: freebsd-questions@freebsd.org > >From: "Don O'Neil" > >To: > >Subject: Help w/ Awk > >Date: Tue, 15 May 2001 18:09:34 -0700 > >MIME-Version: 1.0 > >Content-Transfer-Encoding: 7bit > >X-Priority: 3 (Normal) > >X-MSMail-Priority: Normal > >X-MIMEOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 > >Importance: Normal > >X-Loop: FreeBSD.ORG > > > >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; > > > >#!/bin/sh > >passwd=`cat /etc/passwd` > > > >for user in $passwd > > > >do > > > >username=`echo $user | awk 'BEGIN { FS=":" } END { print $1 }'` > > > >echo $username > > > >done > > > > > >Where am I going wrong with awk? Sometime the result of $username is the > >user name, but sometimes its another part of the entry in the > file. I just > >want the user name stuck into username. > > > >Thanks! > > > > > >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