Xref: utzoo comp.unix.questions:29681 comp.unix.shell:1733 Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!rpi!batcomputer!cornell!uw-beaver!zephyr.ens.tek.com!tektronix!sequent!lugnut From: lugnut@sequent.UUCP (Don Bolton) Newsgroups: comp.unix.questions,comp.unix.shell Subject: Re: Awk with passed parameters Keywords: awk bsd shell Message-ID: <55825@sequent.UUCP> Date: 21 Mar 91 21:04:30 GMT References: <3022@dsacg3.dsac.dla.mil> <1991Mar10.033553.28978@pilikia.pegasus.com> <55345@sequent.UUCP> <1991Mar15.182242.18780@athena.mit.edu> Reply-To: lugnut@sequent.UUCP (Don Bolton) Organization: Sequent Computer Systems, Inc Lines: 35 In article <1991Mar15.182242.18780@athena.mit.edu> jik@athena.mit.edu (Jonathan I. Kamens) writes: >In article <55345@sequent.UUCP>, lugnut@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? > Pretty much was what I were suggesting. I tend to use awk/nawk for gobs of things, but I've also done a lot of date "functions" just using simple shell. and to be true, I was a tad unclear as to what his real mission was. Don "hmm Asics don't taste too bad, little rubbery though" Bolton