Awk with passed parameters

Jonathan I. Kamens jik at athena.mit.edu
Sat Mar 16 04:22:42 AEST 1991


In article <55345 at sequent.UUCP>, lugnut at sequent.UUCP (Don Bolton) writes:
|> I may be missing something obvious here but why use awk at all?
|> 
|> IFS=': '
|> set `date`
|> hrs=$4
|> m=$2   
|> 
|> etc
|> 
|> works just fine for a 12 hour clock display I use from the date output

  How does this solve the problem that the original poster is trying to solve?

  He wanted to use awk to filter the output of "ls" to print out only those
files that were modified today.  What you posted above explains how to set the
month and day to shell variables.  But how are you going to then use that to
filter the output of ls?  If you try to do it completely in the shell, you're
going to have to pipe the output of ls into a loop or function that matches
each line against the month and day.  The matching will have to be done using
"test" or "expr".  Which means (unless you've got a shell with "test" built
in) that you're going to be forking a process to do the test for every line in
the ls listing.

  Is that really what you intended to suggest, or am I missing something?

-- 
Jonathan Kamens			              USnail:
MIT Project Athena				11 Ashford Terrace
jik at Athena.MIT.EDU				Allston, MA  02134
Office: 617-253-8085			      Home: 617-782-0710



More information about the Comp.unix.shell mailing list