Awk with passed parameters

Peter Mielke peter at doe.utoronto.ca
Tue Mar 12 03:42:33 AEST 1991


In <1991Mar10.033553.28978 at pilikia.pegasus.com>, Art Neilson writes:
> In article <3022 at 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 at pilikia.pegasus.com
> Bank of Hawaii Tech Support	| UUCP: uunet!ucsd!nosc!pilikia!art
-- 
Peter Mielke                                    peter at doe.utoronto.ca
Dictionary of Old English Project               utgpu!utzoo!utdoe!peter
University of Toronto



More information about the Comp.unix.questions mailing list