Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uwm.edu!uakari.primate.wisc.edu!ginosko!husc6!spdcc!ima!cfisun!lakart!dg From: dg@lakart.UUCP (David Goodenough) Newsgroups: comp.unix.wizards Subject: Re: awk and shell question Message-ID: <695@lakart.UUCP> Date: 27 Sep 89 19:29:54 GMT References: <4926@macom1.UUCP> Organization: Lakart Corporation, Newton, MA Lines: 21 From article <4926@macom1.UUCP>, by larry@macom1.UUCP (Larry Taborek): > try this instead: > > USER=`cat /etc/passwd | awk -F: '{printf("%-8.8s %-20.20s\n",$1,$5)}'` > echo $USER > > this works, ..... f::1000:31:Finger Pointer:/:/usr/guest/xfinger Not on the above it doesn't (think about it). I suggest: USER=`cat /etc/passwd | sed -e "s/::/:-:/" | \ awk -F: '{printf("%-8.8s %-20.20s\n",$1,$5)}'` -- dg@lakart.UUCP - David Goodenough +---+ IHS | +-+-+ ....... !harvard!xait!lakart!dg +-+-+ | AKA: dg%lakart.uucp@xait.xerox.com +---+