CAN SOMEONE PROVIDE SAMPLE CODE ON HOW TO HANDLE TWO (2) TEXT FILES WITH RECORDS, SUCH AS PASSWORD FILES FROM TWO (2) HOSTS AND BE ABLE TO COMPARE ENTRIES ON BOTH OF THEM AND UPDATE THE SECONDARY PASSWORD FILE WITH ENTRIES FROM THE PRIMARY MASTER PASSWORD FILE?
HOST1 "/etc/passwd" file contains entries such as :
root:!:0:0::/:/usr/bin/ksh
daemon:!:1:1::/etc:
bin:!:2:2::/bin:
sys:!:3:3::/usr/sys:
adm:!:4:4::/var/adm:
uucp:!:5:5::/usr/lib/uucp:
guest:!:100:100::/home/gue
st:
nobody:!:4294967294:429496
7294::/:
lpd:!:9:4294967294::/:
lp:*:11:11::/var/spool/lp:
/bin/false
invscout:*:200:1::/var/adm
/invscout:
/usr/bin/k
sh
nuucp:*:6:5:uucp login user:/var/spool/uucppublic
:/usr/sbin
/uucp/uuci
co
paul:!:201:1::/home/paul:/
usr/bin/ks
h
jdoe:*:202:1:John Doe:/home/jdoe:/usr/bin/ks
h
paul:!:201:1::/home/paul:/
usr/bin/ks
h <== user acct to populate to HOST2
jdoe:*:202:1:John Doe:/home/jdoe:/usr/bin/ks
h <== user acct to populate to HOST2
HOST2 "/etc/passwd" file contains entries such as:
root:!:0:0::/:/usr/bin/ksh
daemon:!:1:1::/etc:
bin:!:2:2::/bin:
sys:!:3:3::/usr/sys:
adm:!:4:4::/var/adm:
uucp:!:5:5::/usr/lib/uucp:
guest:!:100:100::/home/gue
st:
nobody:!:4294967294:429496
7294::/:
What I would like to do is to compare HOST2 password file against HOST1 password file entries, and harmonize HOST2 password file with missing entries from HOST1 password file, being that UID and GID are unique.
I appreciate your insight and recommendation/code samples on how to address this,
Mike McDonald
Start Free Trial