Eu tenho ListIPv6.csv
2001:c00::-2001:dff:ffff:ffff:ffff:ffff:ffff:ffff,iana,1020211200,ZZ,,
2001:e00::-2001:fff:ffff:ffff:ffff:ffff:ffff:ffff,iana,1041379200,ZZ,,
2001:1200::-2001:13ff:ffff:ffff:ffff:ffff:ffff:ffff,iana,1036108800,ZZ,,
2001:1200::-2001:1200:ffff:ffff:ffff:ffff:ffff:ffff,lacnic,1042156800,MX,,
2001:1208::-2001:1208:ffff:ffff:ffff:ffff:ffff:ffff,lacnic,1044230400,MX,,
2001:1210::-2001:1210:ffff:ffff:ffff:ffff:ffff:ffff,lacnic,1095984000,MX,,
2001:1218::-2001:1218:ffff:ffff:ffff:ffff:ffff:ffff,lacnic,1120003200,MX,,
e CountryCode.csv
MX, MEXICO
NZ, NEWZOMBIE
Desejo atualizar a coluna 6 ListIPv6.csv da coluna 2 do CountryCode.csv quando a coluna 4 do ListIPv6.csv corresponder à coluna 1 do CountryCode.csv
A saída esperada de ListIPv6.csv atualizado será:
2001:c00::-2001:dff:ffff:ffff:ffff:ffff:ffff:ffff,iana,1020211200,ZZ,,
2001:e00::-2001:fff:ffff:ffff:ffff:ffff:ffff:ffff,iana,1041379200,ZZ,,
2001:1200::-2001:13ff:ffff:ffff:ffff:ffff:ffff:ffff,iana,1036108800,ZZ,,
2001:1200::-2001:1200:ffff:ffff:ffff:ffff:ffff:ffff,lacnic,1042156800,MX,,MEXICO
2001:1208::-2001:1208:ffff:ffff:ffff:ffff:ffff:ffff,lacnic,1044230400,MX,,MEXICO
2001:1210::-2001:1210:ffff:ffff:ffff:ffff:ffff:ffff,lacnic,1095984000,MX,,MEXICO
2001:1218::-2001:1218:ffff:ffff:ffff:ffff:ffff:ffff,lacnic,1120003200,MX,,MEXICO
Eu usei o comando abaixo, mas ele não preenche meus critérios.
sed -f <(printf 's/%s/%s/g\n' $(<CountryCode.csv)) <(head -n 1000 ListIPv6.csv) >NewListIPv6.csv