I sometimes help out a local school with its network. The other night we found out that username->uid mappings in /etc/passwd and smb.conf were out of sync. Bummer. I printed a list using awk, grep, sort and uniq (at least). Perl seemed like a better and more accurate approach.
I supersearched for csv and diff, but couldn't find anything. Here is what I have:
- passwd has the name in field 1 and the uid in field 3
- smbpasswd has the name in field 1 and the uid in field 2
- both files separate fields with :
- the files are unlikely to be sorted in any manner
- I don't want to compare other fields
- It might be nice to have some sort of generic compare for csv files.
I thought about reading the data into two hashes and doing a brute force compare, but that sounded ugly. Using the uid as an array subscript seems inappropriate as the array might be pretty sparse.
It seems as though someone else might have done this and I'd hate to reinvent this wheel.