On Thu, Aug 30, 2001 at 10:51:12PM -0700, Karsten M. Self wrote: > on Thu, Aug 30, 2001 at 11:09:07PM -0500, ktb ([EMAIL PROTECTED]) wrote: > > On Thu, Aug 30, 2001 at 08:45:29PM -0700, Vineet Kumar wrote: > > > > > > * Brian Schramm ([EMAIL PROTECTED]) [010830 19:41]: > > > > Is there a way that I can take a passwd file and compare the full name > > > > data > > > > in it to the email ldap server and give a a list of what it finds and > > > > what it > > > > misses? I am doing this manually but with the number of users that > > > > there are > > > > involved it is going to be really time consuming. > > > > > > I don't really know what I'm talking about, but this should probably > > > help you get started: > > > > > > awk -F : '{print $5}' /etc/passwd | sed -e "s/^\([^,]*\).*$/\1/" > > > > > > That will give you a list of just the full names. Pipe that into > > > something else that will look each one up in the directory service. > > > > > > Not a complete answer, but it's a start... > > > > BTW what does [ sed -e "s/^\([^,]*\).*$/\1/" ] accomplish? I'm just > > grooving on one liners lately and am curious. It seems like - > > awk -F : '{print $5}' /etc/passwd is all you need to spit out the full > > names. > > Not quite the same thing: > > $ awk -F : '/karsten/ {print $5}' /etc/passwd > Karsten M. Self,,, > > > $ awk -F : '{print $5}' /etc/passwd | sed -e "s/^\([^,]*\).*$/\1/" > Karsten M. Self > > In the original pattern: > > sed -e "s/^\([^,]*\).*$/\1/" > > We have: > > -e: expression to evaluate. > s: create a substitution using the following pattern. > / start of expression > ^ beginning of line (actually, beginning of fifth field > \( start a substitution > [^,]* match zero or more instances of any character other than ',' > \) end substitution > .*$ match to end of line > / end of expression > \1 replace with contents of first substitution (the \([^,]*\) > pattern) > / end expression > > sed is for people who think Perl's too easy to understand.
Thanks for the nice explanation:) What was confusing me is the two /etc/passwd files I ran the various commands against, non of them had and ','s' in them. I just tried my progeny box here at work and see fully what the sed expression is used for. kent