Article View: comp.unix.shell
Article #4582Re: Gawk v24.7: Why Bother???
From: Robert Davies
Date: Wed, 10 May 1995 00:00
Date: Wed, 10 May 1995 00:00
22 lines
1833 bytes
1833 bytes
In article <CHRISB.95May9190513@stork.cssc-syd.tansu.com.au>, chrisb@stork.cssc-syd.tansu.com.au (Chris Bitmead) writes:
*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
*ypcat passwd | gawk -F: '{u[$3]=$1;}END{for(i=100;u[i];i++);print(i);}'
This illustrates exactly the point I made in the Perl V Awk thread.
The perl version is portable, local files, NIS, NIS+, Hesiod.
The awk version is kludgy.
-- Rob
--------------------------------------------------------------------------------
Casper Dik - "The only man who can possibly save Solaris"
--------------------------------------------------------------------------------
Technical Details
Message-ID:
<1995May10.112740.9871@hasler.ascom.ch>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: 10259a,c6417ab4174dabc8 X-Google-Attributes: gid10259a,public X-Google-Thread: 1020c6,f916f0b90003bf8a X-Google-Attributes: gid1020c6,public X-Google-Thread: 1025b4,4df32fd703a6b724 X-Google-Attributes: gid1025b4,public From: rob@abs.ascom.ch (Robert Davies) Subject: Re: Gawk v24.7: Why Bother??? Date: 1995/05/10 Message-ID: <1995May10.112740.9871@hasler.ascom.ch> X-Deja-AN: 102298370 sender: news@hasler.ascom.ch x-nntp-posting-host: problematix.abs.ascom.ch references: <CHRISB.95May9190513@stork.cssc-syd.tansu.com.au> organization: Ascom Telematic AG reply-to: rob@abs.ascom.ch newsgroups: comp.unix.shell,gnu.misc.discuss,comp.lang.perl,comp.unix.admin