Awk with passed parameters
Don Bolton
lugnut at sequent.UUCP
Fri Mar 22 07:04:30 AEST 1991
In article <1991Mar15.182242.18780 at athena.mit.edu> jik at athena.mit.edu (Jonathan I. Kamens) writes:
>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?
>
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
More information about the Comp.unix.questions
mailing list