Subject: Perl, Lisp, scripting, etc. [was: CDR-coding ... ]
From: rpw3@rigden.engr.sgi.com (Rob Warnock)
Date: 19 Dec 2000 07:29:38 GMT
Newsgroups: comp.lang.lisp
Message-ID: <91n2p2$cpk2o$1@fido.engr.sgi.com>
[Trimmed newsgroups, retargeted subject to match content...]

Peter da Silva <peter@abbnm.com> wrote:
+---------------
| Rob Warnock <rpw3@rigden.engr.sgi.com> wrote:
| > Sheesh! Hey, c'mon, Peter, you know better than that:
| > 	egrep /sbin/nologin /etc/passwd | sed -e 's/:.*$//'
| > And it's even fewer characters to type than the Perl version!!  ;-}  ;-}
| 
| What Perl version? I haven't given a Perl version.
+---------------

Sorry, I guess I mis-read your article <URL:news:91eafr$3u7@web.nmti.com>
that started this whole sub-thread, where you said:

	Because you can write two lines of Perl and have a program that
	does something useful on just about any popular OS widely used today.
	Provide a "lispscript" tool that lets you write, oh:
            awk 'BEGIN {FS=":"}; $6=="/sbin/nologin" {print $1}' /etc/passwd

and not being very fluent in Perl myself, I assumed that you were using
some "awk" sub-command of Perl and not the old Unix command-line Awk
program (since obsoleting Awk is one of Perl's main claims to fame).

+---------------
| And what happens if someone's GCOS name is /sbin/nologin? Try:
|  	egrep ":/sbin/nologin$" /etc/passwd | sed -e 's/:.*$//'
+---------------

Thanks for the bug fix.

But even with the fix, it's *still* shorter than the Awk version.
And not only that, it works regardless of how many fields (7 or 8)
the passwd file contains (as someone else was worrying about).


-Rob

-----
Rob Warnock, 31-2-510		rpw3@sgi.com
Network Engineering		http://reality.sgi.com/rpw3/
Silicon Graphics, Inc.		Phone: 650-933-1673
1600 Amphitheatre Pkwy.		PP-ASEL-IA
Mountain View, CA  94043