[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: sendmail questions



On Mon, Aug 16, 1999 at 11:47:38AM +0300, Geoffrey S. Mendelson wrote:

> Any easy way to create the file would be 
> 
> 	cat /etc/passwd | awk -F: '($2 > 100) {print $1}' >/etc/allusers
> 
> This will ignore root, bin, etc.

Join the Useless Use of cat Crazies! Rewrite that as

	awk -F: '($3 > 100) {print $1}' < /etc/passwd > /etc/allusers

(note field #2 is the password)

Err. Waitaminute!!! I'm supposed be advocating Perl:

	perl -lne '/^(.*?):.*?:(\d+)/&&$2>100&&print$1' /etc/passwd
		> /etc/allusers

Darn. Longer :-|

Well, as Larry Wall put it, "AWK has to be better for something :-)"

-- 
believing is seeing
gaal@forum2.org
http://www.forum2.org/gaal/

=================================================================
To unsubscribe, send mail to linux-il-request@linux.org.il with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail linux-il-request@linux.org.il