从字符串中删除不需要的双重特工

时间:2017-06-13 07:23:45

标签: linux shell unix

包含3列的示例文件:

"Mahavir", "Sachin" is boy" , "Ankita"
"abc"    , "xyz" is girl"   , "uvw"

期望的输出:

"Mahavir" , "Sachin is boy , "Ankita"
"abc"    ,  "xyz is girl   , "uvw"

在这里,我想删除你在sachin和xyz附近看到的不需要的双引号。

1 个答案:

答案 0 :(得分:0)

awk -F "," '{gsub(/"( *)$/,"\\\1",$2); print $1","$2","$3}' file