假设我有一个这样的字符串:
Output:
I have some-non-alphanumeric % characters remain here, I "also, have_+ some & .here"
我只想删除引号内的非字母数字字符,逗号、句点或空格除外:
Desired Output:
I have some-non-alphanumeric % characters remain here, I "also, have some .here"
我尝试了以下sed
命令匹配字符串并在引号内删除,但它会删除引号内的所有内容,包括引号:
sed '/characters/ s/\("[^"]*\)\([^a-zA-Z0-9\,\. ]\)\([^"]*"\)//g'
任何帮助表示赞赏,最好使用sed
,以获得所需的输出。提前致谢!