我有一个包含以下数据的文件:
“A”,”Dept1”,”i am mahesh,working in it”,”1”
“B”,”Dept2”,”i am suresh, working in non it”,”2”
我想要的输出是:
A,Dept1,i am mahesh~working in it,1
B,Dept2,i am suresh~working in non it,2
我在下面尝试过,但它正在用 ~ 替换 all ,如下所示:
awk -F ‘“,”’ -v OFS=‘’ ‘{for (i=0;i<=NF;++i) gsub(“,”,”~”,$i)}1’ file
“A”~”Dept1”~”i am mahesh~working in it”~”1”
“B”~”Dept2”~”i am suresh~working in non it”~”2”