From owner-freebsd-current Thu Jan 27 4:11:52 2000 Delivered-To: freebsd-current@freebsd.org Received: from gndrsh.dnsmgr.net (GndRsh.dnsmgr.net [198.145.92.4]) by hub.freebsd.org (Postfix) with ESMTP id D5C81155F2; Thu, 27 Jan 2000 04:11:48 -0800 (PST) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: (from freebsd@localhost) by gndrsh.dnsmgr.net (8.9.3/8.9.3) id EAA76788; Thu, 27 Jan 2000 04:11:38 -0800 (PST) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <200001271211.EAA76788@gndrsh.dnsmgr.net> Subject: Re: (FWD) Re: cvs commit: src/etc/periodic/daily 200.backup-passwd In-Reply-To: <58105.948968676@axl.noc.iafrica.com> from Sheldon Hearn at "Jan 27, 2000 12:24:36 pm" To: sheldonh@uunet.co.za (Sheldon Hearn) Date: Thu, 27 Jan 2000 04:11:38 -0800 (PST) Cc: obrien@FreeBSD.ORG, current@FreeBSD.ORG X-Mailer: ELM [version 2.4ME+ PL54 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > > > On Thu, 27 Jan 2000 00:23:23 PST, "David O'Brien" wrote: > > > I think what you really want is: > > > > sed 's/^\([^:#@+-]*\):[^:]*:/\1:(password):/' > > Eeek, I don't know why I sent you that. It should have been: > > sed 's/^\([ +-][^+-][^:]*\):[^:]*:/\1:(password):/' IMNSO sed is the wrong tool here, awk can deal with the password file much easier than sed and should handle just about any input just so long as it doesn't add any :'s to the lines that we are trying to mungle the password out of: BEGIN {FS=":"; OFS=":"; ORS=""} // {if (NF==10) { print $1,"(password):" for (n = 3; n <=NF; n++) print $n,""; } else print $0; print "\n"; Defantily works on diff, diff -u and diff -c. -- Rod Grimes - KD7CAX @ CN85sl - (RWG25) rgrimes@gndrsh.dnsmgr.net To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message