[Samba] compare users in /etc/passwd versus /etc/samba/smbpasswd
Colb, Andrew
andy at ici.org
Thu Jan 24 21:32:59 GMT 2008
Comm command is ideal; it was built for this type of text processing
problem. It requires sorted ("collated") input lists.
cut -d: -f1 /etc/passwd | sort > pass_f1 # provide sorted list of the
first field in the passwd file
cut -d: -f1 /etc/samba/smbpasswd | sort > smbpass_f1 # provide sorted
list of the first field in the smbpasswd file
then run
comm. -3 pass_f1 smbpass_f1 |more
this will show two columns: first is entries unique to passwd, the
second column are entries unique to smbpasswd
comm command has several forms based on its output in three columns:
lines unique to file1, lines unique to file2 and lines found in both
files.
comm -1 file1 file2 displays the items that are unique to file2 [-1
says omit results unique to file1 ]
comm -2 file1 file2 displays the items that are unique to file1 [-2
says omit results unique to file2]
comm -3 file1 file2 displays the items that are not common to file1
and file2
comm -12 file1 file2 displays the items that are found in both file1
and file2
Andy Colb
Investment Company Institute
-----Original Message-----
From: samba-bounces+acolb=ici.org at lists.samba.org
[mailto:samba-bounces+acolb=ici.org at lists.samba.org] On Behalf Of Ryan
Novosielski
Sent: Thursday, January 24, 2008 2:25 PM
To: John Drescher
Cc: Samba
Subject: Re: [Samba] compare users in /etc/passwd versus
/etc/samba/smbpasswd
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
John Drescher wrote:
> On Jan 24, 2008 1:15 PM, Kristoffer Knigga
<Kknigga at arrow-financial.com> wrote:
>> diff
>>
> probably sort as well and maybe awk
cut -f1 -d: to get the first field. Then sort, then diff, or a new
favorite: comm .
=R
- --
---- _ _ _ _ ___ _ _ _
|Y#| | | |\/| | \ |\ | | |Ryan Novosielski - Systems Programmer II
|$&| |__| | | |__/ | \| _| |novosirj at umdnj.edu - 973/972.0922 (2-0922)
\__/ Univ. of Med. and Dent.|IST/AST - NJMS Medical Science Bldg - C630
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFHmOYcmb+gadEcsb4RAlwxAKDZMjjuURRaHss5hM4QraGP52g7fQCgg3vX
Iaqio+2+Xb7afWRGSUGoe2M=
=I0yg
-----END PGP SIGNATURE-----
More information about the samba
mailing list