Awk with passed parameters

Michael S Figg nfs1675 at dsacg3.dsac.dla.mil
Fri Mar 8 06:29:34 AEST 1991



I'm trying to write a short shell script using awk to list files in the
current directory that have todays' date on them. It seems like something
like this should work, but I haven't had any luck:

set d = `date`
ls -l | awk '$5 == x && $6 == y  {print}' x=$d[2] y=$d[3]

This in a C shell on a BSD machine where $5 is the month and $6 is the day.
I've also tried this on a SVR3.2 machine with a Bourne shell and get similar
results, usually that it can't open "Mar", which I'm assuming is coming from
the 'x=$d[2]'. Any clues on what I'm doing wrong?  I'm sure there are other
ways to do this, but I'd like to get more familar with awk.

---Mike

-- 
 --------       o       A herd of bagels      | Michael Figg  DSAC-FSD
 |      |  --  oo o o   escaping from a deli. | DLA Systems Automation Center
 |      |  -- ooo oo    Looking for Lox in    | Cols, Ohio mfigg at dsac.dla.mil
 --------      o o      all the wrong places  | CIS: 73777,360    



More information about the Comp.unix.questions mailing list