小编use*_*781的帖子

从双引号bash脚本中包含的字符串中删除空格

我一直在使用sep来尝试这个,基本上我有一个文本文件,其中包含相同数量的相同行,例如

4444 username "some information" "someotherinformation" "even more information"
Run Code Online (Sandbox Code Playgroud)

我需要用下划线替换引号内的空格,所以它看起来像这样

4444 username "some_information" "someotherinformation" "even_more_information"
Run Code Online (Sandbox Code Playgroud)

目前我已经能够分离出引用的信息

sed 's/"\([^"]*\)"/_/g' myfile.txt
Run Code Online (Sandbox Code Playgroud)

关于如何进行的建议?

unix string bash awk

3
推荐指数
1
解决办法
1781
查看次数

标签 统计

awk ×1

bash ×1

string ×1

unix ×1