passing command line arguments to awk

Don Steiny steiny at scc.UUCP
Wed Sep 24 14:16:42 AEST 1986


In article <482 at ms3.UUCP>, msitd22 at ms3.UUCP (Jim Chappell) writes:
> In article <731 at scc.UUCP>, steiny at scc.UUCP (Don Steiny) writes:
> > In article <753 at moscom.UUCP>, de at moscom.UUCP (Dave Esan) writes:
> > > > 
> > > > I surrender  --  is it possible to pass command line arguments to awk?
> > > > If so - how.  
> > 
> > 	awk 'statement ; . . . ' file
> > 
> > be sure and use single quotes!   Lots of awk characters have
> > special meaning to the shell.  The following prints the uids in
> > the password file from highest to lowest:
> > 
> > 	awk -F: '{ print $3 }' | sort -n -r
> 
> I bet it sits there forever more because of missing input,
> 
	Right! . . . and then I go . . . "oops" and type

 	awk -F: '{ print $3 }' /etc/passwd | sort -n -r

-- 
scc!steiny
Don Steiny @ Don Steiny Software 
109 Torrey Pine Terrace
Santa Cruz, Calif. 95060
(408) 425-0382



More information about the Comp.unix mailing list