Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!wuarchive!wugate!uunet!munnari.oz.au!csc!ccadfa!usage!basser!metro!extro!natmlab!ditsyda!megadata!ganga From: ganga@megadata.mega.oz (Ganga Varatharajan) Newsgroups: comp.unix.wizards Subject: Re: awk and shell question Message-ID: <200@megadata.mega.oz> Date: 3 Oct 89 07:47:42 GMT References: <4926@macom1.UUCP> Organization: Megadata P/L, North Ryde, Sydney, Aust. Lines: 31 From article <4926@macom1.UUCP>, by larry@macom1.UUCP (Larry Taborek): > > USER=`cat /etc/passwd | awk -F: '{printf("%-8.8s %-20.20s\n",$1,$5)}'` > echo $USER > > this works, but I think what you really want is: > > cat /etc/passwd | awk -F: '{printf("%-8.8s %-20.20s\n",$1,$5)}' > > without the USER=` I'm trying to alias d (csh) as: % dirs -l | awk '{ for (i = 1; i < NF+1; i++) { print i-1,$i } }' to list the directory stack one per line and numbered. % alias d "dirs -l | awk '{ for (i = 1; i < NF+1; i++) { print i-1,$i } }'" gives % $i undefined variable. % alias d 'dirs -l | awk \'{ for (i=1; i < NF+1; i++) { print i-1,$i}}\' ' gives % unmatched ' So I use % alias d "dirs -l | awk -f ~/.dirlist" which is slow. Any suggestions? Thanks Ganga.