Xref: utzoo comp.unix.questions:29347 comp.unix.shell:1661 Newsgroups: comp.unix.questions,comp.unix.shell Path: utzoo!utdoe!peter From: peter@doe.utoronto.ca (Peter Mielke) Subject: Re: Awk with passed parameters In-Reply-To: Art Neilson's message of 10 Mar 91 Message-ID: <1991Mar11.174233.4037@doe.utoronto.ca> Summary: Use shell quoting Keywords: awk bsd shell Reply-To: peter@doe.utoronto.ca (Peter Mielke) Organization: Dictionary of Old English Project, University of Toronto Date: Mon, 11 Mar 1991 17:42:33 GMT In <1991Mar10.033553.28978@pilikia.pegasus.com>, Art Neilson writes: > In article <3022@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: > > Here's my solution using the Bourne shell and standard awk. > > : > > date="`date`" > set $date > > ls -l | awk ' > BEGIN { > mm = '\"$2\"' This should be written like this, as it will fail if $2="two or more words" mm = "'"$2"'" > dd = '\"$3\"' + 0 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 -- Peter Mielke peter@doe.utoronto.ca Dictionary of Old English Project utgpu!utzoo!utdoe!peter University of Toronto