Hi,
I want to know whether it is possible to to execute the below script like
ksh ds.ksh <input file> > <output file> or any other simple way other then ./
The way i'm executing it right now is
nawk -f ds.ksh <input file> > <output file>.
I need the first format as my ETL tools is not able to understand the nawk -f execution format.Is there any change within the program i need to do ?
#!/usr/bin/nawk -f
BEGIN {
FS=OFS="|"
FLD_max=11
FF=sprintf("\f")
}
$0 ~ FF { gsub(FF, ""); $1=$1 }
(fld + NF-1) > FLD_max {
if (fld == FLD_max)
print rec
}
##NF < FLD_max {printf("Bad record: [%d] :: [%s]\n", FNR, $0) | stderr;
NF < FLD_max {rec=(rec != "") ? rec $0 : $0; fld+=(NF-1);next }
{rec=$0; fld=NF}
END {
if (rec != "" && split(rec, a, FS) >= FLD_max ) print rec
Regards,
Kumar