Xref: utzoo comp.unix.questions:29310 comp.unix.shell:1649 Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!ucsd!nosc!humu!pilikia!art From: art@pilikia.pegasus.com (Art Neilson) Newsgroups: comp.unix.questions,comp.unix.shell Subject: Re: Awk with passed parameters Summary: Use shell quoting Keywords: awk bsd shell Message-ID: <1991Mar10.033553.28978@pilikia.pegasus.com> Date: 10 Mar 91 03:35:53 GMT References: <3022@dsacg3.dsac.dla.mil> Organization: Pilikia, Honolulu Lines: 27 In article <3022@dsacg3.dsac.dla.mil> nfs1675@dsacg3.dsac.dla.mil ( Michael S Figg) writes: > > >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] Here's my solution using the Bourne shell and standard awk. : date="`date`" set $date ls -l | awk ' BEGIN { mm = '\"$2\"' dd = '\"$3\"' + 0 } $6 == mm && $7 == dd { print } ' -- Arthur W. Neilson III | INET: art@pilikia.pegasus.com Bank of Hawaii Tech Support | UUCP: uunet!ucsd!nosc!pilikia!art