while putting my daughter to bed, I realized that I'm sure to get a half
dozen people telling me that there are still cases that this will fail
for. Of course, the only proper way is to compare the group to the third
field in the passwd file. That's when I realized you said userid, not
username, so this won't help. sorry.

This is where I switch to perl :)

charles

On Fri, 14 Jan 2000, Charles Galpin wrote:

> Ok, to excluse a userid (first field, no : in front) do
> 
> #!/bin/sh
> TMP=`mktemp /tmp/group.XXXXXX`
> grep -w :`grep "^${1}:" /etc/group | cut -d: -f3` /etc/passwd | cut
> -d: -f1 > $TMP
> grep "^${1}:" /etc/group | cut -d: -f4 | sed 's/,//g' >> $TMP
> cat $TMP | uniq
> rm -f $TMP
> 
> hth
> charles
> 
> On Fri, 14 Jan 2000, William B. Herman wrote:
> 
> > Ok, I made  little modification because if you were looking for a group id,
> > say 10, and a person's group id was 100 it would include them (I just added
> > the -w option after the first grep).  Now, how can I make it so it doesn't
> > include a user who's userid is the same as the groupid I am looking for ?
> > 
> > Here is the code I have now:
> > 
> > #!/bin/sh
> > TMP=`mktemp /tmp/group.XXXXXX`
> > grep -w `grep "^${1}:" /etc/group | cut -d: -f3` /etc/passwd | cut -d: -f1
> > > $TMP
> > grep "^${1}:" /etc/group | cut -d: -f4 | sed 's/,/\
> > /g' >> $TMP
> > cat $TMP | uniq
> > rm -f $TMP
> 
> 
> -- 
> To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe"
> as the Subject.
> 



-- 
To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe"
as the Subject.

Reply via email to