[95538] in RedHat Linux List

home help back first fref pref prev next nref lref last post

Re: =?iso-8859-1?Q?comparing_Two_different_passwd=B4s?=

daemon@ATHENA.MIT.EDU (Kevin Smith)
Mon Oct 19 10:43:12 1998

Date: Mon, 19 Oct 1998 09:46:06 -0500 (CDT)
From: Kevin Smith <kevin@mtsu.edu>
To: redhat-list@redhat.com
In-Reply-To: <Pine.LNX.3.96.981019093731.6362A-100000@gspawt.ruthfd1.tn.home.com>
Resent-From: redhat-list@redhat.com
Reply-To: redhat-list@redhat.com

On Mon, 19 Oct 1998, Kevin Smith wrote:

> Assuming you are using a bash shell:
> 
> -- cut --
> for i in `cut -d: -f1 /etc/passwd`
> do
> 	grep $i `cut -d: -f1 /etc/passwd2`
> done
> -- end --
> 
> That will show you which usernames are in both files...

Well.. now that I think of it.. this will return some false positives..
here is a better version:

-- cut --
for i in `cut -d: -f1 /etc/passwd`; do grep ^$i: /etc/passwd2; done | cut -d: -f1
-- cut --

That will return the correct results... the other would return any
usernames with another username within them... so if john was in the first
passwd file, then john, johnny, subjohn, billjohn, etc.. would all be
returned, which isn't exactly accurate....

-----
Kevin Smith
kevin@mtsu.edu


-- 
  PLEASE read the Red Hat FAQ, Tips, Errata and the MAILING LIST ARCHIVES!
		http://www.redhat.com http://archive.redhat.com
         To unsubscribe: mail redhat-list-request@redhat.com with 
                       "unsubscribe" as the Subject.


home help back first fref pref prev next nref lref last post