[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Just a question



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



Or, if you only know awk...

awk -F : '/Brian/ {print $5}' /etc/passwd | awk -F , '{print $1}'

The former looks much cooler, though. :-)

--
Brian J. Stults
Department of Sociology
University of Florida
Box 117330
Gainesville, Florida 32611-7330
phone:  (352) 392-0265 x286
fax:    (352) 392-6568
e-mail: bstults@soc.ufl.edu



Reply to: