Hello...
I am trying to convert my script from one to another unix flavor...
from reliant to solaris...I did all but can not convert this awk/nawk:
First code if code that works what I want under reliant and the second should do same under solaris but it does not
I did so far from this :
awk -vx=$deldate90 -vy=$deldate60 -vz=$unixdate '
{ins = $4 $5 $6
expdate = $4 $5 $6
{ if ( ins != "20010101" )
{ if ( expdate < z )
{if ( expdate < x )
print $1","$2","$3"," $5"."$6"."$4",O" > ("St");
if ( expdate >= x )
{ if (expdate < y)
print $1","$2","$3"," $5"."$6"."$4",D" > ("De")
if ( expdate >= y )
print $1","$2","$3"," $5"."$6"."$4",N" > ("In")}}
if ( expdate >= z && $4 != 2030)
print $1","$2","$3"," $5"."$6"."$4",A" > ("Ak")}}} ' myfile
to this:
nawk -v x=$deldate90 -v w=$deldate60 -v z=$unixdate '
{
expdate = $4 $5 $6
if (expdate < z)
{
if (expdate < x)
{
print $1","$2","$3"," $5"."$6"."$4",O" > ("/path/to/some/St")
}
else if (expdate >= x)
{
if (expdate < w)
{
print $1","$2","$3"," $5"."$6"."$4",D" > ("/path/to/some/De")
}
else
{
print $1","$2","$3"," $5"."$6"."$4",N" > ("/path/to/some/In")
}
}
}
else if (expdate >= z && $4 != 2030)
{
print $1","$2","$3"," $5"."$6"."$4",A" > ("/path/to/some/Ak")
}
}' myfile
but this new code does not do same thing like first one...