home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!dtix!darwin.sura.net!zaphod.mps.ohio-state.edu!sdd.hp.com!hpscdc!hplextra!hpcc05!hpyhde4!hpycla!hpergfg2!hprdash!hprpcd!tmilner
- From: tmilner@hprpcd.rose.hp.com (Tom Milner)
- Newsgroups: comp.unix.questions
- Subject: Re: I want a program that prints out base gid's of any user
- Message-ID: <15360003@hprpcd.rose.hp.com>
- Date: 26 Aug 92 20:12:40 GMT
- References: <BtIqyp.F5A@news.cso.uiuc.edu>
- Organization: Performance Technology Center, Roseville
- Lines: 31
-
- In comp.unix.questions, bzg52408@uxa.cso.uiuc.edu (Benjamin Z. Goldsteen) writes:
-
-
- | I have been trying to write a program that prints out the
- | base gid of a user (given on the command line). I have tried
- | using awk and perl, but I can not get anything decent.
- | Can show me how to do this. One thing I have tried
- | [ gid username ]
- | #! /usr/bin/awk -f
- | BEGIN { FS=":"; FILENAME="/etc/passwd" }
- | ARGV[1] == $1 {print $4}
- |
- | I am not sure if 1 if right for ARGV, but whatever...anyway, it
- | won't read from /etc/passwd - it only reads from stdin. I can;t
- | make it do otherwise.
- |
- | I don't really understand perl...
- |
- | Thanks
-
- Try the "id" command ... as in
- id | sed "s/.*(\(.*\))/\1/"
- _____________________________________
- /_______________ ___________________/
- / /
- / /
- / / Tom Milner (Tn: 785-5637)
- / / HP Performance Tech Center
- / / tom@hpptc16.rose.hp.com
- /_/ __________________________
-
-