尝试:
sed -e 's/[^,.]*\.\(..\)[^,]*/\1/g' myfile.txt
一个测试:
echo "GB400.VIATIC.VQ051.CV750T1.D-,SB400.GIATIC.VQ051.CV902T1.D-,SB400.GIATIC.VQ051.CV902S1.D.-" \ | sed -e 's/[^,.]*\.\(..\)[^,]*/\1/g'
输出:
VI,GI,GI