SFU awk help

hi guys

i am trying using this awk command which works perfectly on unix

awk '$1>=dt' dt="2007-12-03" filename 

but when i run same command for same file under SFU it does nothing simply prints the file ( just like cat command ) i am not getting why ?
any way i used sed for same ( little complicated way but it works ) can u tell me u can i make it work ?

Try a standard version of the code:

dt="2007-12-03"
awk -v dat="$dt" '{ if($1>=dat) {print $0} }'  filename

Could you please elaborate a bit further?

Well, this does seem odd...

$ awk   '$1>=dt' dt="2007-12-03" data
2007-12-01 too early
2007-12-03 exact match
2007-12-12 afterwards
$
$
$ awk   '$1>=dt {print $0}' dt="2007-12-03" data
2007-12-03 exact match
2007-12-12 afterwards
$
$
$ uname -a
Interix octave 3.5 SP-8.0.1969.1 x86 Intel_x86_Family15_Model2_Stepping7
$

Both of the above commands violate the man page which states that variable assignments must precede the awk program and have a -v. But doing it right has the same effects...

$ awk -v dt="2007-12-03" '$1 >= dt' data
2007-12-01 too early
2007-12-03 exact match
2007-12-12 afterwards
$ awk   -v dt="2007-12-03" '$1 >= dt { print $0 }' data
2007-12-03 exact match
2007-12-12 afterwards
$

It looks like a bug to me.

Hm, strange ...
All Awk versions I use and know (nawk, GNU Awk, mawk and even the old broken Solaris awk) behave as expected.
AFAIK the variable assignment var=value is part of the syntax
and it's documented in the man pages (I checked the old Solaris Awk and GNU Awk man pages):

P.S. It's important to note that the old Awk implementations (ex. Solaris /usr[/bin]/awk) don't support the -v assignment! They support the one discussed above.

This is cheap, but...

awk '$1>='"$dt"' filename
  or even:
awk "\$1>=\"$dt\"" filename

It requires neither method for passing-in values, but makes the quoting a bit messy.