Article View: comp.unix.shell
Article #4581Re: Gawk v24.7: Why Bother???
From: dam
Date: Tue, 09 May 1995 00:00
Date: Tue, 09 May 1995 00:00
38 lines
2269 bytes
2269 bytes
Chris Bitmead (chrisb@stork.cssc-syd.tansu.com.au) wrote:
: In article <3o2k4j$sv7@pipe.pipex.net> tim@pipex.net (Tim Goodwin) writes:
: >In article <3nsibr$879@kimble.mistral.co.uk>,
: >Mark Sheppard <kimble@mistral.co.uk> wrote:
: >>> # find first unused uid after 100, even with perl4
: >>> perl -le '$i = 100; $i++ while ($x) = getpwuid($i); print $i'
: >>
: >>You can do this using gawk:
: >>
: >>gawk -F: '{u[$3]=$1;}END{for(i=100;u[i];i++);print(i);}' /etc/passwd
: >
: >The awk script doesn't work if you're using NIS, or in general when
: >/etc/passwd doesn't contain every uid.
: ypcat passwd | gawk -F: '{u[$3]=$1;}END{for(i=100;u[i];i++);print(i);}'
I don't know how portable it is, but under HP-UX, pwget works.
pwget | | gawk -F: '{u[$3]=$1;}END{for(i=100;u[i];i++);print(i);}'
I know, cause we just put up yp and I had to rewrite a bunch of awk
scripts.
: --
: Chris Bitmead
: chrisb@ind.tansu.com.au
--
Dan Mercer ClearSystems, Inc
Reply To: damercer@mmm.com "The Mad Pedant"
======================================================================
All opinions expressed are my own and do not reflect the opinions of
my employer or my employer's clients, in particular 3M Company.
All advice or software offered or presented is provided As Is with no
warranty either expressed or implied. Follow at your own risk.
Objects in the mirror are closer than they appear.
Technical Details
Message-ID:
<3oo7a4$dpf@dawn.mmm.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<CHRISB.95May9190513@stork.cssc-syd.tansu.com.au>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1012a6,4df32fd703a6b724 X-Google-Attributes: gid1012a6,public X-Google-Thread: 1020c6,f916f0b90003bf8a X-Google-Attributes: gid1020c6,public X-Google-Thread: 1025b4,4df32fd703a6b724 X-Google-Attributes: gid1025b4,public X-Google-Thread: 10259a,c6417ab4174dabc8 X-Google-Attributes: gid10259a,public From: dam@medlab9.mmm.com () Subject: Re: Gawk v24.7: Why Bother??? Date: 1995/05/09 Message-ID: <3oo7a4$dpf@dawn.mmm.com> X-Deja-AN: 102298349 references: <CHRISB.95May9190513@stork.cssc-syd.tansu.com.au> followup-to: comp.unix.shell,gnu.misc.discuss,comp.lang.perl,comp.unix.admin organization: ClearSystems, Inc newsgroups: comp.unix.shell,gnu.misc.discuss,comp.lang.perl,comp.unix.admin