Article View: comp.unix.shell
Article #4593Re: Gawk v24.7: Why Bother???
From: Tim Goodwin
Date: Mon, 01 May 1995 00:00
Date: Mon, 01 May 1995 00:00
16 lines
1334 bytes
1334 bytes
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.
Tim.
--
Tim Goodwin | "BIND does not like VM." -- Paul Vixie
Public IP Exchange |
Technical Details
Message-ID:
<3o2k4j$sv7@pipe.pipex.net>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<3mpj9f$d1h@csnews.cs.colorado.edu> <3n8qt8$shf@smurf.noris.de> <3nbdqv$cbc@csnews.cs.colorado.edu> <3nsibr$879@kimble.mistral.co.uk>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,2f1e554b7912769e X-Google-Attributes: gid1020c6,public X-Google-Thread: 10259a,c6417ab4174dabc8 X-Google-Attributes: gid10259a,public X-Google-Thread: 1025b4,4df32fd703a6b724 X-Google-Attributes: gid1025b4,public From: tim@pipex.net (Tim Goodwin) Subject: Re: Gawk v24.7: Why Bother??? Date: 1995/05/01 Message-ID: <3o2k4j$sv7@pipe.pipex.net> X-Deja-AN: 101876351 references: <3mpj9f$d1h@csnews.cs.colorado.edu> <3n8qt8$shf@smurf.noris.de> <3nbdqv$cbc@csnews.cs.colorado.edu> <3nsibr$879@kimble.mistral.co.uk> organization: PIPEX, 216 Science Park, Cambridge, England newsgroups: comp.unix.shell,gnu.misc.discuss,comp.lang.perl,comp.unix.admin