Code:
awk -F/ '
NR == 1 {printf "Sl#,VideoName,BitRate"
}
FNR == NR {PRM[NR] = "( |no-)" $0 "=*[^ /]*"
MX = NR
printf ",%s", $0
next
}
!HDFIN {printf RS
HDFIN = 1
}
FNR == 1 {gsub (" ", "", $3)
printf "%d,%s,%d", ++FCNT, FILENAME, $3+0
}
FNR == 3 {for (i=1; i<=MX; i++) {match ($0, PRM[i])
n = split (substr ($0, RSTART, RLENGTH), TMP, "=")
if (n == 2) printf ",%s", TMP[2]
else if (n == 1) printf ",%d", (! (TMP[1] ~ /^no/))
else printf ",NA"
}
printf RS
}
' Required_para.txt OFS=, vid?
Sl#,VideoName,BitRate,input-res,crf,aq-mode,strong-intra-smoothing,bframes,rc-lookahead,me,subme,merange,deblock,selective-sao,psy-rd,psy-rdoq,ctu,rdoq-level,max-merge,ref,max-tu-size,transfer,colormatrix,colorprim,selective-sao
1,vid1,5750,1920x816,23.3,3,0,8,100,3,7,92,0:0,NA,2.00,1.00,32,2,4,5,16,1,1,1,NA
2,vid2,3711,1920x804,18.0,3,1,8,25,3,3,57,0:0,0,2.00,1.00,64,2,3,4,32,2,2,2,0
3,vid3,7903,1920x800,18.0,3,1,8,25,3,3,57,0:0,0,2.00,1.00,64,2,3,4,32,2,2,2,0