Code:
BEGIN {
qq="\""
tab=sprintf("\t")
FS=":"
OFS=","
fldL="ffid,LineNumber,PointNumber,x,y,z,date,Valid,AcquisitionLength,AcquisitionNumber,FileDate,FileSize,GPSTimeOfAcquisition,JulianDay,NumberOfAuxes,NumberOfDeadSeisTraces,NumberOfLiveSeisTraces,NumberOfSeisTraces,RecordLength,SampleRate,SourceEasting,SourceNorthing,SourceLineNumber,SourcePointNumber,SwathName,TapeNumber,SweepLength,TestRecordType,TotalNumberOfTraces,TypeOfSource,PointIndex,preEasting,preNorthing,postEasting,postNorthing,offset,cogStatus,fleet_nb,VIB1_drive,VIB2_drive,VIB1_vib_status,VIB2_vib_status,VIB1_id,VIB2_id,VIB1_gps_quality,VIB2_gps_quality,VIB1_over_mass,VIB2_over_mass,VIB1_dist_avg,VIB2_dist_avg,VIB1_dist_peak,VIB2_dist_peak"
#fldL="ffid,LineNumber,PointNumber,x,y,z,date,Valid,AcquisitionLength,AcquisitionNumber,FileDate,FileSize,GPSTimeOfAcquisition,JulianDay,NumberOfAuxes,NumberOfDeadSeisTraces,NumberOfLiveSeisTraces,NumberOfSeisTraces,RecordLength,SampleRate,SourceEasting,SourceNorthing,SourceLineNumber,SourcePointNumber,SwathName,TapeNumber,SweepLength,TestRecordType,TotalNumberOfTraces,TypeOfSource,PointIndex,preEasting,preNorthing,postEasting,postNorthing,offset,cogStatus,fleet_nb,VIB1_drive,VIB2_drive,VIB1_vib_status,VIB2_vib_status,VIB1_id,VIB2_id,VIB1_gps_quality,VIB2_gps_quality,VIB1_over_mass,VIB2_over_mass,VIB1_dist_avg,VIB2_dist_avg,VIB1_dist_peak,VIB2_dist_peak,RMS_noise,RMS_refracted,RMS_GR,RMS_AW,RMS_signal1,RMS_signal2,FreqDom_noise,FreqDom_refracted,FreqDom_GR,FreqDom_AW,FreqDom_signal1,FreqDom_signal2,Bandw_noise,Bandw_refracted,Bandw_GR,Bandw_AW,Bandw_signal1,Bandw_signal2,SN_noise,SN_refracted,SN_GR,SN_AW,SN_signal1,SN_signal2"
fldN=split(fldL, fldT, OFS)
for(i=1; i in fldT; i++)
fldA[fldT[i]]=i
print fldL
}
function normStr(str)
{
gsub("[" OFS qq tab " ]", "", str)
return str
}
function arrayFull(a, i)
{
for(i=1; i<= fldN; i++)
if (!(i in a))
return 0
return 1
}
arrayFull(outputA) {
for(i=1; i in outputA; i++)
printf("%s%s", outputA[i], (i==fldN)?ORS:OFS)
split("", outputA)
}
normStr($1) in fldA { outputA[fldA[normStr($1)]]=normStr($NF) }