[MITgcm-devel] testreport on sunos

Oliver Jahn jahn at MIT.EDU
Wed Jun 25 10:07:36 EDT 2008


Hi Martin,

I think it should be
> tst=`echo $sVar $listVar | awk '{ for(i=2;i<=NF;i++){if($i==$1){t+=1}}; print t }'`
                                                                  ^^^^^^
since in gawk, ($i==$1) evaluates to 1 (true) if $i==$1 and 0 (false) 
otherwise.  testreport checks for tst to be equal to 1 (found one match) 
or not.  Don't have a sun awk to test this, though.

I think there is a program called nawk ('new awk') on sun that should 
behave similarly to awks on other systems (not just linux).

Oliver


On Wed, 25 Jun 2008, Martin Losch wrote:

> Me again,
>
> I actually found someone with "awk"-skills and we figured that the correct 
> syntax would be this:
>> tst=`echo $sVar $listVar | awk '{ for(i=2;i<=NF;i++){if($i==$1);t+=$1}; 
>> print t }'`
> on the command line this give the same result, but within testreport it 
> causes this problem:
>> ==> WARNING: selected var >PS< not found
>> ==> WARNING: in checked list: PS Tmn Tmx Tav Tsd Smn Smx Sav Ssd Umn Umx 
>> Uav Usd Vmn Vmx Vav Vsd pt1mn pt1mx pt1av pt1sd pt2mn pt2mx pt2av pt2sd 
>> pt3mn pt3mx pt3av pt3sd pt4mn pt4mx pt4av pt4sd pt5mn pt5mx pt5av pt5sd
>
>
> Maybe you can help?
>
> Martin
>
> On 25 Jun 2008, at 09:12, Martin Losch wrote:
>
>> Hallo Jean-Michel,
>> 
>> there is a small problem with testreport on SunOS (rays1); and as usual the 
>> problem boils down to "awk". Obviously "awk" on linux systems is real 
>> "gawk". "gawk" has more features than awk and we are gettting so used to 
>> (g)awk that that we don't realize it's the "wrong" awk. Anyway, the 
>> SunOS-awk returns an error in line 229:
>> tst=`echo $sVar $listVar | awk '{ for(i=2;i<=NF;i++){t+=($i==$1)}; print t 
>> }'`
>> and more specifically it is this part: ($i==$1) that awk does not recognize 
>> (gawk does, even on SunOS). What can we do?
>> 1. Replace awk with gawk in this line? I am not sure that gawk is available 
>> on all systems.
>> 2. replace all "awk"s with $AWK and set this or pass this as an argument?
>> 3. I like best: find a syntax that SunOS awk can handle. I don't know what 
>> this line really does, and in particular, what t+=($i==$1) is supposed to 
>> do, but maybe there is a better way of doing this (with sed, which is more 
>> universal, as far as I remember from our problems with genmake2 years ago). 
>> Do you still have access to a Sun? If not, can you describe what this thing 
>> is supposed to do and I'll try to figure out how to do it on a Sun.
>> 
>> I believe there are still users on SunOS (there were some emails, 
>> recently), and this problem is likely to occur on other systems that do not 
>> run Linux (e.g. SX8, or IBM, ...)
>> 
>> Martin
>> 
>> PS. I don't think that this thing actually causes problems with testreport 
>> in my case (somehow emails don't get sent to jmc at mitgcm.org since last 
>> week), but it's still worth fixing.
>> _______________________________________________
>> MITgcm-devel mailing list
>> MITgcm-devel at mitgcm.org
>> http://mitgcm.org/mailman/listinfo/mitgcm-devel
>
> _______________________________________________
> MITgcm-devel mailing list
> MITgcm-devel at mitgcm.org
> http://mitgcm.org/mailman/listinfo/mitgcm-devel



More information about the MITgcm-devel mailing list