awk -F"," -v q='"' '{ print q $2 q " " ":=" " " q $1,$3,$4,$5,$6,$7,$8 q"," }' fil1.txt > dg.txt
-v q='â' | is used to insert double quotes around the key-value pairs with q as variable containing the quotes |
-Fâ,â | the file is comma separated so we tell awk to that as field separator |
fil1.txt
DHE-RSA-DES-CBC-SHA,0x15,64,TLS1-TLS1.1-TLS1.2-DTLS1,EDH,RSA,DES,SHA DHE-RSA-DES-CBC3-SHA,0x16,168,TLS1-TLS1.1-TLS1.2-DTLS1,EDH,RSA,DES,SHA ADH-RC4-MD5,0x18,128,TLS1,ADH,None,RC4,MD5 ADH-DES-CBC-SHA,0x1a,64,TLS1,ADH,None,DES,SHA ADH-DES-CBC3-SHA,0x1b,168,TLS1,ADH,None,DES,SHA AES128-SHA,0x2f,128,TLS1-TLS1.1-TLS1.2-DTLS1,RSA,RSA,AES,SHA DHE-DSS-AES128-SHA,0x32,128,TLS1-TLS1.1-TLS1.2-DTLS1,DHE,DSS,AES,SHA DHE-RSA-AES128-SHA,0x33,128,TLS1-TLS1.1-TLS1.2-DTLS1,EDH,RSA,AES,SHA ADH-AES128-SHA,0x34,128,TLS1,ADH,None,AES,SHA AES256-SHA,0x35,256,TLS1-TLS1.1-TLS1.2-DTLS1,RSA,RSA,AES,SHA DHE-DSS-AES256-SHA,0x38,256,TLS1-TLS1.1-TLS1.2-DTLS1,DHE,DSS,AES,SHA DHE-RSA-AES256-SHA,0x39,256,TLS1-TLS1.1-TLS1.2-DTLS1,EDH,RSA,AES,SHA ADH-AES256-SHA,0x3a,256,TLS1,ADH,None,AES,SHA AES128-SHA256,0x3c,128,TLS1.2,RSA,RSA,AES,SHA256 AES256-SHA256,0x3d,256,TLS1.2,RSA,RSA,AES,SHA256 RC4-MD5,0x4,128,TLS1-TLS1.1-TLS1.2,RSA,RSA,RC4,MD5 ... ... ...
dg.txt
"0x15" := "DHE-RSA-DES-CBC-SHA 64 TLS1-TLS1.1-TLS1.2-DTLS1 EDH RSA DES SHA", "0x16" := "DHE-RSA-DES-CBC3-SHA 168 TLS1-TLS1.1-TLS1.2-DTLS1 EDH RSA DES SHA", "0x18" := "ADH-RC4-MD5 128 TLS1 ADH None RC4 MD5", "0x1a" := "ADH-DES-CBC-SHA 64 TLS1 ADH None DES SHA", "0x1b" := "ADH-DES-CBC3-SHA 168 TLS1 ADH None DES SHA", "0x2f" := "AES128-SHA 128 TLS1-TLS1.1-TLS1.2-DTLS1 RSA RSA AES SHA", "0x32" := "DHE-DSS-AES128-SHA 128 TLS1-TLS1.1-TLS1.2-DTLS1 DHE DSS AES SHA", "0x33" := "DHE-RSA-AES128-SHA 128 TLS1-TLS1.1-TLS1.2-DTLS1 EDH RSA AES SHA", "0x34" := "ADH-AES128-SHA 128 TLS1 ADH None AES SHA", "0x35" := "AES256-SHA 256 TLS1-TLS1.1-TLS1.2-DTLS1 RSA RSA AES SHA", "0x38" := "DHE-DSS-AES256-SHA 256 TLS1-TLS1.1-TLS1.2-DTLS1 DHE DSS AES SHA", "0x39" := "DHE-RSA-AES256-SHA 256 TLS1-TLS1.1-TLS1.2-DTLS1 EDH RSA AES SHA", "0x3a" := "ADH-AES256-SHA 256 TLS1 ADH None AES SHA", "0x3c" := "AES128-SHA256 128 TLS1.2 RSA RSA AES SHA256", "0x3d" := "AES256-SHA256 256 TLS1.2 RSA RSA AES SHA256", "0x4" := "RC4-MD5 128 TLS1-TLS1.1-TLS1.2 RSA RSA RC4 MD5", "0x40" := "DHE-DSS-AES128-SHA256 128 TLS1.2 DHE DSS AES SHA256", "0x41" := "CAMELLIA128-SHA 128 TLS1-TLS1.1-TLS1.2 RSA RSA CAMELLIA SHA", "0x44" := "DHE-DSS-CAMELLIA128-SHA 128 TLS1-TLS1.1-TLS1.2 DHE DSS CAMELLIA SHA", "0x45" := "DHE-RSA-CAMELLIA128-SHA 128 TLS1-TLS1.1-TLS1.2 EDH RSA CAMELLIA SHA", "0x5" := "RC4-SHA 128 TLS1-TLS1.1-TLS1.2 RSA RSA RC4 SHA", "0x67" := "DHE-RSA-AES128-SHA256 128 TLS1.2 EDH RSA AES SHA256", "0x6a" := "DHE-DSS-AES256-SHA256 256 TLS1.2 DHE DSS AES SHA256", "0x6b" := "DHE-RSA-AES256-SHA256 256 TLS1.2 EDH RSA AES SHA256", "0x84" := "CAMELLIA256-SHA 256 TLS1-TLS1.1-TLS1.2 RSA RSA CAMELLIA SHA", "0x87" := "DHE-DSS-CAMELLIA256-SHA 256 TLS1-TLS1.1-TLS1.2 DHE DSS CAMELLIA SHA", "0x88" := "DHE-RSA-CAMELLIA256-SHA 256 TLS1-TLS1.1-TLS1.2 EDH RSA CAMELLIA SHA", "0x9" := "DES-CBC-SHA 64 TLS1-TLS1.1-DTLS1 RSA RSA DES SHA", "0x9c" := "AES128-GCM-SHA256 128 TLS1.2 RSA RSA AES-GCM SHA256", "0x9d" := "AES256-GCM-SHA384 256 TLS1.2 RSA RSA AES-GCM SHA384", ... ... ...